@defra/interactive-map 0.0.54-alpha → 0.0.56-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/add-polygons.njk +1 -1
- package/assets/templates/add-symbols.njk +4 -4
- package/assets/templates/draw-tools.njk +7 -7
- package/assets/templates/marker-panel.njk +5 -5
- package/assets/templates/place-marker.njk +8 -8
- package/assets/templates/search-control.njk +1 -1
- package/assets/templates/select-feature.njk +7 -7
- package/assets/templates/style-switcher.njk +6 -6
- package/assets/templates/toggle-marker-label.njk +3 -3
- package/dist/esm/im-core.js +1 -1
- package/dist/esm/im-shell.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/dist/umd/im-core.js.LICENSE.txt +0 -30
- package/dist/umd/index.js +1 -1
- package/dist/umd/index.js.LICENSE.txt +0 -20
- package/docs/api/context.md +2 -0
- package/docs/api.md +20 -14
- package/docs/architecture/interactive-map.likec4 +4 -4
- package/docs/building-a-plugin.md +2 -2
- package/docs/examples/add-marker-with-panel.mdx +46 -44
- package/docs/examples/add-polygons.mdx +100 -98
- package/docs/examples/add-symbols.mdx +75 -73
- package/docs/examples/basic-map.mdx +16 -14
- package/docs/examples/button-map.mdx +16 -14
- package/docs/examples/draw-tools.mdx +119 -117
- package/docs/examples/place-marker.mdx +51 -49
- package/docs/examples/search-control.mdx +22 -20
- package/docs/examples/select-feature.mdx +107 -105
- package/docs/examples/style-switcher.mdx +47 -45
- package/docs/examples/toggle-marker-label.mdx +30 -28
- package/docs/getting-started.md +26 -24
- package/docs/plugins/datasets.md +11 -0
- package/docs/plugins/draw.md +18 -12
- package/docs/plugins/interact.md +33 -10
- package/docs/plugins/plugin-descriptor.md +1 -1
- package/docs/plugins/search.md +5 -5
- package/docusaurus.config.cjs +48 -3
- package/govuk-prototype-kit.config.json +6 -7
- package/package.json +22 -29
- package/plugins/datasets/dist/esm/im-datasets-esri-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/esm/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/esm/index.js +1 -1
- package/plugins/datasets/dist/esm/layerAdapter.js +1 -1
- package/plugins/datasets/dist/esm/mapboxStyleLayerAdapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ml-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-ol-adapter.js +1 -1
- package/plugins/datasets/dist/umd/im-datasets-plugin.js +1 -1
- package/plugins/datasets/dist/umd/index.js +1 -1
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.js +18 -16
- package/plugins/datasets/src/adapters/esri/esriLayerAdapter.test.js +2 -2
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.js +2 -3
- package/plugins/datasets/src/adapters/esri/registry/esriDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/loadLayerAdapter.js +2 -20
- package/plugins/datasets/src/adapters/loadLayerAdapter.test.js +9 -9
- package/plugins/datasets/src/adapters/mapboxStyleLayerAdapter.js +7 -7
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.js +19 -19
- package/plugins/datasets/src/adapters/maplibre/maplibreLayerAdapter.test.js +1 -1
- package/plugins/datasets/src/adapters/maplibre/registry/mapLibreDataset.test.js +1 -1
- package/plugins/datasets/src/adapters/openlayers/canvasPatternStyle.test.js +2 -2
- package/plugins/datasets/src/adapters/openlayers/layerBuilders.test.js +1 -1
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.js +21 -21
- package/plugins/datasets/src/adapters/openlayers/openlayersLayerAdapter.test.js +5 -5
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.js +2 -3
- package/plugins/datasets/src/adapters/openlayers/registry/openLayersDataset.test.js +2 -2
- package/plugins/datasets/src/api/getOpacity.js +1 -2
- package/plugins/datasets/src/api/getOpacity.test.js +9 -12
- package/plugins/datasets/src/api/getStyle.js +1 -2
- package/plugins/datasets/src/api/getStyle.test.js +5 -8
- package/plugins/datasets/src/api/removeDataset.js +2 -4
- package/plugins/datasets/src/api/removeDataset.test.js +5 -10
- package/plugins/datasets/src/api/setData.js +2 -4
- package/plugins/datasets/src/api/setData.test.js +6 -14
- package/plugins/datasets/src/api/setFeatureVisibility.js +1 -2
- package/plugins/datasets/src/api/setFeatureVisibility.test.js +8 -11
- package/plugins/datasets/src/components/LayersMenu/LayersMenu.jsx +1 -0
- package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.jsx +1 -3
- package/plugins/datasets/src/components/LayersMenu/LayersMenuCheckbox.test.jsx +13 -18
- package/plugins/datasets/src/index.js +2 -2
- package/plugins/datasets/src/index.test.js +8 -1
- package/plugins/datasets/src/initialise/DatasetsInit.jsx +48 -26
- package/plugins/datasets/src/initialise/DatasetsInit.test.jsx +160 -89
- package/plugins/datasets/src/initialise/initialiseDatasets.js +2 -3
- package/plugins/datasets/src/initialise/initialiseDatasets.test.js +23 -10
- package/plugins/datasets/src/manifest.js +53 -44
- package/plugins/datasets/src/manifest.test.js +36 -4
- package/plugins/datasets/src/reducers/pluginState.js +5 -5
- package/plugins/datasets/src/reducers/pluginState.test.js +21 -20
- package/plugins/datasets/src/registry/__mocks__/datasetRegistry.js +7 -6
- package/plugins/datasets/src/registry/createDataset.js +2 -2
- package/plugins/datasets/src/registry/dataset.js +9 -10
- package/plugins/datasets/src/registry/dataset.test.js +63 -64
- package/plugins/datasets/src/registry/datasetRegistry.js +39 -10
- package/plugins/datasets/src/registry/datasetRegistry.test.js +83 -1
- package/plugins/datasets/src/registry/globalDataset.js +9 -17
- package/plugins/datasets/src/registry/isVisibleWhen.js +9 -17
- package/plugins/datasets/src/registry/isVisibleWhen.test.js +27 -20
- package/plugins/datasets/src/registry/mapboxStyleDataset.test.js +26 -27
- package/plugins/datasets/src/utils/hasLayersMenu.js +13 -0
- package/plugins/datasets/src/utils/hasLayersMenu.test.js +25 -0
- package/plugins/draw/dist/esm/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/esm/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/esm/index.js +1 -1
- package/plugins/draw/dist/esm/liveDrawChecks.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ml-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-ol-adapter.js +1 -1
- package/plugins/draw/dist/umd/im-draw-plugin.js +1 -1
- package/plugins/draw/dist/umd/index.js +1 -1
- package/plugins/draw/src/DrawInit.jsx +47 -26
- package/plugins/draw/src/DrawInit.test.jsx +90 -2
- package/plugins/draw/src/adapters/maplibre/styles.js +3 -2
- package/plugins/draw/src/adapters/maplibre/styles.test.js +3 -3
- package/plugins/draw/src/adapters/openlayers/core/styles.test.js +1 -1
- package/plugins/draw/src/adapters/openlayers/point/pointSymbolImages.test.js +1 -1
- package/plugins/draw/src/manifest.js +3 -2
- package/plugins/draw/src/manifest.test.js +13 -1
- package/plugins/draw/src/utils/needsDrawTarget.js +22 -0
- package/plugins/draw/src/utils/needsDrawTarget.test.js +42 -0
- package/plugins/draw-es/dist/esm/im-draw-es-plugin.js +1 -0
- package/plugins/draw-es/dist/esm/index.js +1 -0
- package/plugins/{beta/draw-es → draw-es}/src/DrawInit.jsx +1 -1
- package/plugins/{beta/draw-es → draw-es}/src/events.test.js +1 -1
- package/plugins/{beta/draw-es → draw-es}/src/graphic.js +1 -1
- package/plugins/frame/dist/esm/im-frame-plugin.js +1 -0
- package/plugins/frame/dist/esm/index.js +1 -0
- package/plugins/frame/dist/umd/im-frame-plugin.js +1 -0
- package/plugins/frame/dist/umd/index.js +2 -0
- package/plugins/{beta/frame → frame}/package.json +2 -2
- 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 +3 -3
- package/plugins/interact/src/api/enable.test.js +13 -0
- package/plugins/interact/src/defaults.js +1 -0
- package/plugins/interact/src/hooks/useCrossHairVisibility.js +27 -17
- package/plugins/interact/src/hooks/useCrossHairVisibility.test.js +72 -7
- package/plugins/interact/src/manifest.js +4 -4
- package/plugins/interact/src/manifest.test.js +29 -0
- package/plugins/interact/src/reducer.js +7 -2
- package/plugins/interact/src/reducer.test.js +12 -2
- package/plugins/interact/src/utils/needsTarget.js +20 -0
- package/plugins/interact/src/utils/needsTarget.test.js +36 -0
- package/plugins/map-key/dist/esm/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/esm/index.js +1 -1
- package/plugins/map-key/dist/umd/im-map-key-plugin.js +1 -1
- package/plugins/map-key/dist/umd/index.js +1 -1
- package/plugins/map-key/src/components/Key/KeySvgSymbol.jsx +4 -0
- package/plugins/map-key/src/components/Key/MapKey.jsx +15 -15
- package/plugins/map-key/src/components/Key/MapKey.test.jsx +29 -15
- package/plugins/map-key/src/initialise/MapKeyInit.jsx +5 -8
- package/plugins/map-key/src/initialise/MapKeyInit.test.jsx +9 -7
- package/plugins/map-key/src/manifest.test.js +0 -1
- package/plugins/map-key/src/reducers/mergeKeyGroupItems.js +14 -33
- package/plugins/map-key/src/reducers/mergeKeyGroupItems.test.js +34 -50
- package/plugins/map-key/src/reducers/pluginState.js +6 -1
- package/plugins/map-key/src/reducers/pluginState.test.js +13 -4
- package/plugins/map-styles/dist/esm/im-map-styles-plugin.js +1 -0
- package/plugins/map-styles/dist/esm/index.js +1 -0
- package/plugins/map-styles/dist/umd/im-map-styles-plugin.js +1 -0
- package/plugins/map-styles/dist/umd/index.js +2 -0
- package/plugins/{beta/map-styles → map-styles}/src/MapStyles.jsx +2 -2
- package/plugins/{beta/map-styles → map-styles}/src/MapStylesInit.jsx +1 -1
- package/plugins/menu/dist/esm/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/esm/index.js +1 -1
- package/plugins/menu/dist/umd/im-menu-plugin.js +1 -1
- package/plugins/menu/dist/umd/index.js +1 -1
- package/plugins/scale-bar/dist/esm/im-scale-bar-plugin.js +1 -0
- package/plugins/scale-bar/dist/esm/index.js +1 -0
- package/plugins/scale-bar/dist/umd/im-scale-bar-plugin.js +1 -0
- package/plugins/scale-bar/dist/umd/index.js +2 -0
- package/plugins/{beta/scale-bar → scale-bar}/package.json +2 -2
- 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/components/Suggestions/Suggestions.jsx +3 -1
- package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +11 -0
- package/plugins/search/src/utils/markedToElements.jsx +25 -0
- package/plugins/search/src/utils/markedToElements.test.jsx +49 -0
- package/plugins/search/src/utils/parseOsNamesResults.js +6 -4
- package/plugins/search/src/utils/parseOsNamesResults.test.js +18 -0
- package/plugins/use-location/dist/esm/im-use-location-plugin.js +1 -0
- package/plugins/use-location/dist/esm/index.js +1 -0
- package/plugins/use-location/dist/umd/im-use-location-plugin.js +1 -0
- package/plugins/use-location/dist/umd/index.js +2 -0
- package/providers/esri/dist/esm/im-esri-provider.js +1 -0
- package/providers/esri/dist/esm/index.js +1 -0
- package/providers/{beta/esri → esri}/src/esriProvider.js +1 -1
- package/providers/{beta/esri → esri}/src/mapEvents.js +2 -2
- 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 +3 -3
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-worker.js +2 -0
- package/providers/maplibre/dist/umd/im-maplibre-worker.js.LICENSE.txt +4 -0
- package/providers/maplibre/dist/umd/index.js +1 -1
- package/providers/maplibre/src/index.js +41 -12
- package/providers/maplibre/src/index.test.js +43 -12
- package/providers/maplibre/src/utils/detectModuleWorker.js +25 -0
- package/providers/maplibre/src/utils/detectModuleWorker.test.js +40 -0
- package/providers/maplibre/src/utils/spatial.js +22 -12
- package/providers/maplibre/src/utils/spatial.test.js +6 -6
- package/providers/maplibre/src/utils/workerUrl.js +15 -0
- package/providers/maplibre/src/utils/workerUrl.test.js +14 -0
- package/providers/open-names/dist/esm/im-reverse-geocode.js +1 -0
- package/providers/open-names/dist/esm/index.js +1 -0
- package/providers/open-names/dist/umd/im-reverse-geocode.js +2 -0
- package/providers/open-names/dist/umd/index.js +2 -0
- package/providers/openlayers/dist/esm/im-openlayers-provider.js +1 -0
- package/providers/openlayers/dist/esm/index.js +1 -0
- package/providers/openlayers/dist/umd/im-openlayers-provider.js +2 -0
- package/providers/openlayers/dist/umd/index.js +2 -0
- package/providers/openlayers/src/index.js +60 -0
- package/providers/openlayers/src/index.test.js +47 -0
- package/providers/{beta/openlayers → openlayers}/src/mapEvents.js +2 -2
- package/providers/{beta/openlayers → openlayers}/src/mapEvents.test.js +2 -2
- package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.js +3 -3
- package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.js +1 -1
- package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.js +1 -1
- package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.js +1 -1
- package/rollup.esm.mjs +79 -46
- package/sonar-project.properties +1 -1
- package/src/App/App.jsx +4 -1
- package/src/App/App.test.jsx +6 -0
- package/src/App/renderer/PluginInits.jsx +8 -7
- package/src/App/renderer/PluginInits.test.jsx +20 -5
- package/src/App/renderer/SlotItemsProvider.jsx +33 -0
- package/src/App/renderer/SlotItemsProvider.test.jsx +59 -0
- package/src/App/renderer/SlotRenderer.jsx +3 -14
- package/src/App/renderer/SlotRenderer.test.jsx +11 -44
- package/src/App/renderer/mapButtons.js +22 -11
- package/src/App/renderer/mapButtons.test.js +23 -1
- package/src/App/renderer/mapControls.js +6 -8
- package/src/App/renderer/mapControls.test.js +10 -0
- package/src/App/renderer/mapPanels.js +16 -19
- package/src/App/renderer/mapPanels.test.js +37 -9
- package/src/App/renderer/pluginWrapper.js +10 -8
- package/src/App/renderer/pluginWrapper.test.js +23 -9
- package/src/App/renderer/slotAggregator.js +18 -5
- package/src/App/renderer/slotAggregator.test.js +68 -25
- package/src/App/renderer/slotHelpers.js +13 -0
- package/src/App/renderer/slotHelpers.test.js +16 -1
- package/src/App/store/AppProvider.jsx +19 -1
- package/src/App/store/AppProvider.test.jsx +41 -0
- package/src/App/store/appActionsMap.js +10 -1
- package/src/App/store/appActionsMap.test.js +21 -0
- package/src/App/store/appDispatchMiddleware.js +29 -17
- package/src/App/store/appDispatchMiddleware.test.js +31 -0
- package/src/InteractiveMap/InteractiveMap.js +2 -1
- package/src/InteractiveMap/InteractiveMap.test.js +9 -2
- package/src/InteractiveMap/domStateManager.js +21 -1
- package/src/InteractiveMap/domStateManager.test.js +48 -1
- package/src/InteractiveMap/parseDataProperties.js +4 -4
- package/src/InteractiveMap/parseDataProperties.test.js +62 -6
- package/src/InteractiveMap/polyfills.js +4 -3
- package/src/InteractiveMap/polyfills.test.js +12 -0
- package/src/config/events.js +4 -2
- package/src/scss/tools/_govuk-content.scss +4 -3
- package/src/types.js +3 -5
- package/webpack.dev.mjs +11 -3
- package/webpack.prod.mjs +11 -4
- package/webpack.umd.mjs +34 -14
- package/plugins/beta/draw-es/dist/esm/im-draw-es-plugin.js +0 -1
- package/plugins/beta/draw-es/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ml/dist/esm/im-draw-ml-plugin.js +0 -1
- package/plugins/beta/draw-ml/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ml/dist/umd/im-draw-ml-plugin.js +0 -1
- package/plugins/beta/draw-ml/dist/umd/index.js +0 -2
- package/plugins/beta/draw-ml/src/DrawInit.jsx +0 -85
- package/plugins/beta/draw-ml/src/api/addFeature.js +0 -27
- package/plugins/beta/draw-ml/src/api/deleteFeature.js +0 -13
- package/plugins/beta/draw-ml/src/api/editFeature.js +0 -75
- package/plugins/beta/draw-ml/src/api/merge.js +0 -9
- package/plugins/beta/draw-ml/src/api/newLine.js +0 -68
- package/plugins/beta/draw-ml/src/api/newPolygon.js +0 -68
- package/plugins/beta/draw-ml/src/api/split.js +0 -81
- package/plugins/beta/draw-ml/src/defaults.js +0 -17
- package/plugins/beta/draw-ml/src/draw.scss +0 -26
- package/plugins/beta/draw-ml/src/events.js +0 -185
- package/plugins/beta/draw-ml/src/index.js +0 -13
- package/plugins/beta/draw-ml/src/manifest.js +0 -110
- package/plugins/beta/draw-ml/src/mapboxDraw.js +0 -143
- package/plugins/beta/draw-ml/src/mapboxSnap.js +0 -321
- package/plugins/beta/draw-ml/src/modes/createDrawMode.js +0 -552
- package/plugins/beta/draw-ml/src/modes/disabledMode.js +0 -23
- package/plugins/beta/draw-ml/src/modes/drawLineMode.js +0 -18
- package/plugins/beta/draw-ml/src/modes/drawPolygonMode.js +0 -16
- package/plugins/beta/draw-ml/src/modes/editVertex/geometryHelpers.js +0 -135
- package/plugins/beta/draw-ml/src/modes/editVertex/helpers.js +0 -2
- package/plugins/beta/draw-ml/src/modes/editVertex/touchHandlers.js +0 -142
- package/plugins/beta/draw-ml/src/modes/editVertex/undoHandlers.js +0 -133
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexOperations.js +0 -142
- package/plugins/beta/draw-ml/src/modes/editVertex/vertexQueries.js +0 -121
- package/plugins/beta/draw-ml/src/modes/editVertexMode.js +0 -495
- package/plugins/beta/draw-ml/src/reducer.js +0 -90
- package/plugins/beta/draw-ml/src/styles.js +0 -190
- package/plugins/beta/draw-ml/src/undoStack.js +0 -50
- package/plugins/beta/draw-ml/src/utils/debounce.js +0 -16
- package/plugins/beta/draw-ml/src/utils/flattenStyleProperties.js +0 -49
- package/plugins/beta/draw-ml/src/utils/snapHelpers.js +0 -200
- package/plugins/beta/draw-ml/src/utils/spatial.js +0 -258
- package/plugins/beta/draw-ol/dist/css/index.css +0 -1
- package/plugins/beta/draw-ol/dist/esm/DrawMode.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/EditMode.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/geometryHelpers.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/im-draw-ol-plugin.js +0 -1
- package/plugins/beta/draw-ol/dist/esm/index.js +0 -1
- package/plugins/beta/draw-ol/src/DrawInit.jsx +0 -65
- package/plugins/beta/draw-ol/src/api/addFeature.js +0 -29
- package/plugins/beta/draw-ol/src/api/deleteFeature.js +0 -11
- package/plugins/beta/draw-ol/src/api/editFeature.js +0 -50
- package/plugins/beta/draw-ol/src/api/newLine.js +0 -44
- package/plugins/beta/draw-ol/src/api/newPolygon.js +0 -44
- package/plugins/beta/draw-ol/src/core/OLDrawManager.js +0 -153
- package/plugins/beta/draw-ol/src/core/featureStore.js +0 -65
- package/plugins/beta/draw-ol/src/core/styles.js +0 -98
- package/plugins/beta/draw-ol/src/core/undoStack.js +0 -31
- package/plugins/beta/draw-ol/src/defaults.js +0 -16
- package/plugins/beta/draw-ol/src/draw/DrawMode.js +0 -121
- package/plugins/beta/draw-ol/src/draw/drawInput.js +0 -243
- package/plugins/beta/draw-ol/src/draw.scss +0 -17
- package/plugins/beta/draw-ol/src/edit/EditMode.js +0 -424
- package/plugins/beta/draw-ol/src/edit/keyboardHandler.js +0 -229
- package/plugins/beta/draw-ol/src/edit/midpointLayer.js +0 -57
- package/plugins/beta/draw-ol/src/edit/touchHandler.js +0 -171
- package/plugins/beta/draw-ol/src/edit/undoOps.js +0 -95
- package/plugins/beta/draw-ol/src/edit/vertexHitTest.js +0 -72
- package/plugins/beta/draw-ol/src/edit/vertexLayer.js +0 -49
- package/plugins/beta/draw-ol/src/edit/vertexOps.js +0 -99
- package/plugins/beta/draw-ol/src/events.js +0 -114
- package/plugins/beta/draw-ol/src/index.js +0 -12
- package/plugins/beta/draw-ol/src/manifest.js +0 -125
- package/plugins/beta/draw-ol/src/olDraw.js +0 -38
- package/plugins/beta/draw-ol/src/reducer.js +0 -41
- package/plugins/beta/draw-ol/src/snap/snapEngine.js +0 -153
- package/plugins/beta/draw-ol/src/snap/snapGeometry.js +0 -177
- package/plugins/beta/draw-ol/src/snap/snapIndicator.js +0 -81
- package/plugins/beta/draw-ol/src/snap/snapInteraction.js +0 -57
- package/plugins/beta/draw-ol/src/snap/snapManager.js +0 -99
- package/plugins/beta/draw-ol/src/utils/flattenStyleProperties.js +0 -47
- package/plugins/beta/draw-ol/src/utils/geometryHelpers.js +0 -103
- package/plugins/beta/draw-ol/src/utils/olCoords.js +0 -35
- package/plugins/beta/draw-ol/src/utils/resolveColors.js +0 -39
- package/plugins/beta/draw-ol/src/utils/spatial.js +0 -24
- package/plugins/beta/draw-ol/src/utils/touchTarget.js +0 -61
- package/plugins/beta/frame/dist/esm/im-frame-plugin.js +0 -1
- package/plugins/beta/frame/dist/esm/index.js +0 -1
- package/plugins/beta/frame/dist/umd/im-frame-plugin.js +0 -1
- package/plugins/beta/frame/dist/umd/index.js +0 -2
- package/plugins/beta/map-styles/dist/esm/im-map-styles-plugin.js +0 -1
- package/plugins/beta/map-styles/dist/esm/index.js +0 -1
- package/plugins/beta/map-styles/dist/umd/im-map-styles-plugin.js +0 -1
- package/plugins/beta/map-styles/dist/umd/index.js +0 -2
- package/plugins/beta/scale-bar/dist/esm/im-scale-bar-plugin.js +0 -1
- package/plugins/beta/scale-bar/dist/esm/index.js +0 -1
- package/plugins/beta/scale-bar/dist/umd/im-scale-bar-plugin.js +0 -1
- package/plugins/beta/scale-bar/dist/umd/index.js +0 -2
- package/plugins/beta/use-location/dist/esm/im-use-location-plugin.js +0 -1
- package/plugins/beta/use-location/dist/esm/index.js +0 -1
- package/plugins/beta/use-location/dist/umd/im-use-location-plugin.js +0 -1
- package/plugins/beta/use-location/dist/umd/index.js +0 -2
- package/plugins/map-key/src/registry/getDatasetRegistry.js +0 -6
- package/plugins/map-key/src/registry/getDatasetRegistry.test.js +0 -23
- package/plugins/map-key/src/registry/index.js +0 -1
- package/plugins/map-key/src/registry/index.test.js +0 -7
- package/providers/beta/esri/dist/esm/im-esri-provider.js +0 -1
- package/providers/beta/esri/dist/esm/index.js +0 -1
- package/providers/beta/open-names/dist/esm/im-reverse-geocode.js +0 -1
- package/providers/beta/open-names/dist/esm/index.js +0 -1
- package/providers/beta/open-names/dist/umd/im-reverse-geocode.js +0 -2
- package/providers/beta/open-names/dist/umd/index.js +0 -2
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +0 -1
- package/providers/beta/openlayers/dist/esm/index.js +0 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +0 -2
- package/providers/beta/openlayers/dist/umd/index.js +0 -2
- package/providers/beta/openlayers/dist/umd/index.js.LICENSE.txt +0 -1
- package/providers/beta/openlayers/src/index.js +0 -37
- /package/plugins/{beta/draw-es → draw-es}/src/api/addFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/deleteFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/editFeature.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/newPolygon.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/api/removeSafeZone.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/events.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/index.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/manifest.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/reducer.js +0 -0
- /package/plugins/{beta/draw-es → draw-es}/src/sketchViewModel.js +0 -0
- /package/plugins/{beta/frame → frame}/dist/css/index.css +0 -0
- /package/plugins/{beta/draw-ml → frame}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/frame → frame}/src/Frame.jsx +0 -0
- /package/plugins/{beta/frame → frame}/src/FrameInit.jsx +0 -0
- /package/plugins/{beta/frame → frame}/src/api/addFrame.js +0 -0
- /package/plugins/{beta/frame → frame}/src/api/editFeature.js +0 -0
- /package/plugins/{beta/frame → frame}/src/config.js +0 -0
- /package/plugins/{beta/frame → frame}/src/frame.scss +0 -0
- /package/plugins/{beta/frame → frame}/src/index.js +0 -0
- /package/plugins/{beta/frame → frame}/src/manifest.js +0 -0
- /package/plugins/{beta/frame → frame}/src/reducer.js +0 -0
- /package/plugins/{beta/frame → frame}/src/utils.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/dist/css/index.css +0 -0
- /package/plugins/{beta/frame → map-styles}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/config.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/index.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/manifest.js +0 -0
- /package/plugins/{beta/map-styles → map-styles}/src/mapStyles.scss +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/dist/css/index.css +0 -0
- /package/plugins/{beta/map-styles → scale-bar}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.jsx +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/ScaleBar.test.jsx +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/index.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/index.test.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/manifest.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/scaleBar.scss +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/utils.js +0 -0
- /package/plugins/{beta/scale-bar → scale-bar}/src/utils.test.js +0 -0
- /package/plugins/{beta/scale-bar → use-location}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/plugins/{beta/use-location → use-location}/src/UseLocation.jsx +0 -0
- /package/plugins/{beta/use-location → use-location}/src/UseLocationInit.jsx +0 -0
- /package/plugins/{beta/use-location → use-location}/src/defaults.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/events.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/index.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/manifest.js +0 -0
- /package/plugins/{beta/use-location → use-location}/src/reducer.js +0 -0
- /package/providers/{beta/esri → esri}/dist/css/index.css +0 -0
- /package/providers/{beta/esri → esri}/src/appEvents.js +0 -0
- /package/providers/{beta/esri → esri}/src/defaults.js +0 -0
- /package/providers/{beta/esri → esri}/src/esriProvider.scss +0 -0
- /package/providers/{beta/esri → esri}/src/index.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/coords.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/coords.test.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/detectWebGL.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/esriFixes.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/query.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/spatial.js +0 -0
- /package/providers/{beta/esri → esri}/src/utils/spatial.test.js +0 -0
- /package/providers/{beta/open-names → open-names}/dist/umd/im-reverse-geocode.js.LICENSE.txt +0 -0
- /package/{plugins/beta/use-location → providers/open-names}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{beta/open-names → open-names}/src/index.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/reverseGeocode.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.js +0 -0
- /package/providers/{beta/open-names → open-names}/src/utils/mapToLocationModel.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/dist/umd/im-openlayers-provider.js.LICENSE.txt +0 -0
- /package/providers/{beta/open-names → openlayers}/dist/umd/index.js.LICENSE.txt +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/appEvents.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/appEvents.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/defaults.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/openlayersProvider.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/bngProjection.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/filterEvaluator.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/highlightFeatures.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/hoverCursor.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/openLayersFixes.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/patternImages.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/queryFeatures.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/spatial.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/symbolImages.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/tileLayers.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/vtTileFragments.test.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.js +0 -0
- /package/providers/{beta/openlayers → openlayers}/src/utils/zoom.test.js +0 -0
package/dist/esm/im-shell.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/defineProperty";import i from"@babel/runtime/helpers/objectWithoutProperties";var n=function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=window.location)||void 0===t?void 0:t.search;return new URLSearchParams(i).get(e)},r=e=>{var{behaviour:t,hybridWidth:i,maxMobileWidth:n}=e;if("hybrid"!==t)return!1;var r=null!=i?i:n;return window.matchMedia("(max-width: ".concat(r,"px)")).matches},o=e=>{var{behaviour:t}=e;return["mapOnly","buttonFirst"].includes(t)||r(e)};function a(){s.forEach(e=>{!function(e,t){var i;if(!1!==e.config.manageHistoryState){e._isClosingViaBack=!1;var n=e.id===t,o="hybrid"===e.config.behaviour&&!r(e.config),a=null===(i=e.rootEl)||void 0===i?void 0:i.children.length;!n||a&&!e._isHidden?n||!a||o||function(e){var t,i;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(i=e.removeApp)||void 0===i||i.call(e)}(e):function(e){var t,i;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(i=e.loadApp)||void 0===i||i.call(e)}(e)}}(e,n(e.config.mapViewQueryParam))})}var s=new Map,l=!1;var c={register:function(e){l||(globalThis.addEventListener("popstate",a),l=!0),s.set(e.id,e)},unregister:function(e){s.delete(e.id),0===s.size&&(globalThis.removeEventListener("popstate",a),l=!1)}};function u(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function d(e){try{return JSON.parse(e)}catch(e){return console.log(e),null}}function p(e){var i=function(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?u(Object(n),!0).forEach(function(i){t(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({},null==e?void 0:e.dataset),n={};for(var r of Object.keys(i))n[r]=d(i[r]);return n}function h(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var v=(e,t,i,n)=>e!==t&&!(null!=i&&i.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&n.contains(e);function m(e){var t,{containerEl:i,isFullscreen:n,boundaryEl:r=document.body}=e,o=Array.from(r.querySelectorAll("[data-fm-inert]"));if(i&&(o=o.filter(e=>!i.contains(e))),o.forEach(e=>{e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),n){null===(t=document.activeElement)||void 0===t||t.blur();for(var a=i;null!==(s=a)&&void 0!==s&&s.parentNode&&a!==r&&a!==document.body;){var s,l=a.parentNode;for(var c of l.children)v(c,a,i,r)&&(c.setAttribute("aria-hidden","true"),c.dataset.fmInert="");a=l}}}function f(e){var{isFullscreen:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{config:i,rootEl:o}=e,{pageTitle:a,behaviour:s,containerHeight:l}=i,c=null!=t?t:function(e){var{id:t,behaviour:i,manageHistoryState:o}=e;return"mapOnly"===i||("buttonFirst"===i?!1===o||n(e.mapViewQueryParam)===t:r(e)&&n(e.mapViewQueryParam)===t)}(i);["mapOnly","buttonFirst","hybrid"].includes(s)&&(m({containerEl:o,isFullscreen:c}),document.documentElement.classList.toggle("im-is-fullscreen",c),o.classList.toggle("im-is-fullscreen",c)),["buttonFirst","hybrid"].includes(s)&&function(e){var{pageTitle:t,isFullscreen:i}=e,n=document.title.split(": "),r=n[n.length-1];document.title=i?"".concat(t,": ").concat(r):r}({pageTitle:a,isFullscreen:c});var u=c||"buttonFirst"!==s&&!r(i)?l:"auto";return o.style.height=c?"100%":u,{isFullscreen:c}}function b(){document.body.classList.remove("im-is-loading")}var P="[interactive-map]",_={warn:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return console.warn(P,...t)},error:function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return console.error(P,...t)}};var A={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function E(e){var{id:t,behaviour:i}=e,o=n(e.mapViewQueryParam)===t;return["mapOnly","inline"].includes(i)||"hybrid"===i&&!r(e)||o}var y={appColorScheme:"light",autoColorScheme:!1,backgroundColor:"var(--background-color)",behaviour:"buttonFirst",buttonClass:"im-c-open-map-button",buttonText:"Map view",containerHeight:"600px",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",enableFullscreen:!1,enableMapControls:!0,enableZoomControls:!0,genericErrorText:"There was a problem loading the map. Please try again later.",hasExitButton:!1,backAndContinue:null,hybridWidth:null,keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <span class="im-u-visually-hidden">Question mark</span><kbd aria-hidden="true">?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',mapHintText:"Press Tab to focus it. Keyboard commands are only available once it has focus.",mapLabel:"Interactive map application",mapProvider:null,mapSize:"small",manageHistoryState:!0,mapViewQueryParam:"mv",urlPosition:"sync",maxMobileWidth:640,minDesktopWidth:835,mapControlsHintText:'A "map controls" button is also available, opening further controls for moving and zooming.',nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1},g=["mapViewParamKey"];function w(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function O(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?w(Object(n),!0).forEach(function(i){t(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function T(e){var t,{maxMobileWidth:i,minDesktopWidth:n,containerEl:r}=e,o="unknown",a=new Set,s=e=>{e!==o&&(o=e,requestAnimationFrame(()=>{o===e&&a.forEach(t=>t(e))}))};if(r){var l=function(e,t,i){e.style.containerType="inline-size";var n=e.getBoundingClientRect().width,r=t(n);e.dataset.breakpoint=r;var o=new window.ResizeObserver(n=>{var r,o,a=(null===(r=n[0])||void 0===r||null===(r=r.borderBoxSize)||void 0===r||null===(r=r[0])||void 0===r?void 0:r.inlineSize)||(null===(o=n[0])||void 0===o?void 0:o.contentRect.width),s=t(a);e.dataset.breakpoint=s,i(s)});return o.observe(e),{initialType:r,cleanup:()=>{o.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(r,e=>function(e,t,i){return e<=t?"mobile":e>=i?"desktop":"tablet"}(e,i,n),s);o=l.initialType,s(l.initialType),t=l.cleanup}else{var c=function(e,t,i){var n={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},r=()=>{var e="tablet";n.mobile.matches?e="mobile":n.desktop.matches&&(e="desktop"),i(e)};return n.mobile.addEventListener("change",r),n.desktop.addEventListener("change",r),r(),{cleanup:()=>{n.mobile.removeEventListener("change",r),n.desktop.removeEventListener("change",r)}}}(i,n,s);t=c.cleanup}return{subscribe:e=>(a.add(e),()=>a.delete(e)),getBreakpoint:()=>o,destroy:()=>{var e;null===(e=t)||void 0===e||e(),a.clear()}}}var S=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",D=new Set,M=new Set;var k=new Set(["Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape"]),B=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]);function L(e){S!==e&&(S=e,M.forEach(t=>t(e)),D.forEach(t=>t(e)))}function x(){var e=window.matchMedia("(pointer: coarse)"),t=e=>{L(e.matches?"touch":"mouse")};e.addEventListener("change",t);var i=e=>{var t,i="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";i!==S&&(S=i,M.forEach(e=>e(i)),setTimeout(()=>{D.forEach(e=>e(i))},150))},n=e=>{var t;("Tab"===e.key||k.has(e.key)&&(!(t=e.target)||"TEXTAREA"!==t.tagName&&!t.isContentEditable&&("INPUT"!==t.tagName||B.has(t.type))))&&L("keyboard")};return window.addEventListener("pointerdown",i,{passive:!0}),window.addEventListener("keydown",n,{passive:!0}),()=>{e.removeEventListener("change",t),window.removeEventListener("pointerdown",i),window.removeEventListener("keydown",n)}}function C(){return"unknown"===S?(S="mouse","mouse"):S}function R(e){return D.add(e),()=>{D.delete(e)}}var I=null;function j(){return null!==I}function N(e,t){if(!I)throw new Error("ReverseGeocode not initialised");return I(e,t)}class H{constructor(){this.events={},this._queued={}}on(e,t){if(this.events[e]||(this.events[e]=[]),this.events[e].push(t),void 0!==this._queued[e]){try{t(...this._queued[e])}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}delete this._queued[e]}return this}once(e,t){var i=this,n=function(){i.off(e,n),t(...arguments)};return this.on(e,n)}off(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(e=>e!==t):[],this):this}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.events[e]?(this.events[e].forEach(t=>{try{t(...i)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}emitWhenReady(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return this.events[e]&&0!==this.events[e].length?this.emit(e,...i):(this._queued[e]=i,this)}emitWhenRequested(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];var r="".concat(e,"Requested"),o="".concat(e,"Ready"),a=()=>this.emit(o,...i);return this.on(r,a),a(),()=>this.off(r,a)}requestOnce(e,t){var i="".concat(e,"Requested"),n="".concat(e,"Ready");return this.once(n,t),this.emit(i,e),this}destroy(){this.events={},this._queued={}}}if("undefined"!=typeof crypto&&!crypto.randomUUID){var F=0;crypto.randomUUID=()=>(F=Math.max(Date.now(),F+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e,t)=>{var i=t<12?Number.parseInt(F.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?i:3&i|8).toString(16)}))}var U=!Object.hasOwn;U&&(Object.hasOwn=(e,t)=>Object.prototype.hasOwnProperty.call(e,t));var V="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;V&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}});if((V||U)&&"undefined"!=typeof URL&&URL.createObjectURL){var W="text/javascript",q=["if(!Object.hasOwn){Object.hasOwn=function(o,k){return Object.prototype.hasOwnProperty.call(o,k)}}\n",V?'if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n':""].join(""),z=URL.createObjectURL.bind(URL);if(URL.createObjectURL=e=>(e instanceof Blob&&e.type===W&&(e=new Blob([q,e],{type:W})),z(e)),"undefined"!=typeof Worker){var G=Worker;Worker=function(e,t){if("string"==typeof e&&!e.startsWith("blob:")){var i=new Blob(["".concat(q,"importScripts(").concat(JSON.stringify(e),")")],{type:W});e=z(i)}return new G(e,t)},Worker.prototype=G.prototype}}function K(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),i.push.apply(i,n)}return i}function Q(e){for(var i=1;i<arguments.length;i++){var n=null!=arguments[i]?arguments[i]:{};i%2?K(Object(n),!0).forEach(function(i){t(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class Y{constructor(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t(this,"_openButton",null),t(this,"_root",null),t(this,"_breakpointDetector",null),t(this,"_interfaceDetectorCleanup",null),t(this,"_hybridBehaviourCleanup",null),t(this,"_isHidden",!1),t(this,"_isClosingViaBack",!1),t(this,"_isLoading",!1),this.id=e,this.rootEl=document.getElementById(e),!this.rootEl)throw new Error('Element with id "'.concat(e,'" not found'));this.eventBus=new H,this.config=this._buildConfig(i),function(e,t){var{mapProvider:i,deviceNotSupportedText:n}=t,r=null==i?void 0:i.checkDeviceCapabilities();return i?!(null==r||!r.isSupported)||(h(e,n),b(),_.warn(null==r?void 0:r.error),!1):(_.warn("No map provider"),!1)}(this.rootEl,this.config)&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&c.register(this),this._breakpointDetector=T({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=x(),this._initialize())}_buildConfig(e){var t=p(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{mapViewParamKey:t}=e,n=i(e,g),r=O(O({},y),n);return void 0!==t&&(console.warn("[InteractiveMap] mapViewParamKey is deprecated — use mapViewQueryParam instead."),r.mapViewQueryParam=t),"mapOnly"===r.behaviour&&r.hasExitButton&&(console.warn("[InteractiveMap] hasExitButton has no effect when behaviour is 'mapOnly' — there is nothing to exit to."),r.hasExitButton=!1),r}(Q(Q({id:this.id,title:document.title},t),e))}_initialize(){["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(e,t,i){var{id:n,buttonText:r,buttonClass:o}=e,a='\n <a class="'.concat(o,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(r,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");t.insertAdjacentHTML("beforebegin",a);var s=t.previousElementSibling,l=new URL(window.location.href);return l.searchParams.set(e.mapViewQueryParam,n),s.setAttribute("href",l.toString()),s.addEventListener("click",e=>{e.preventDefault(),i(e)}),s}(this.config,this.rootEl,e=>{this._handleButtonClick(e)})),this._hybridBehaviourCleanup=function(e){var{behaviour:t,hybridWidth:i,maxMobileWidth:n}=e.config;if("buttonFirst"===t&&e._breakpointDetector.subscribe(()=>{E(e.config)?e.loadApp():e.removeApp()}),"hybrid"===t){var r=null!=i?i:n,o=window.matchMedia("(max-width: ".concat(r,"px)")),a=()=>{if(E(e.config))if(e._isHidden)e.showApp();else if(null==e._root)e.loadApp();else{var{isFullscreen:t}=f(e);e.eventBus.emit(A.APP_FULLSCREEN_CHANGE,{isFullscreen:t})}else e._root&&e.hideApp()};return o.addEventListener("change",a),()=>o.removeEventListener("change",a)}return null}(this),E(this.config)?this.loadApp():b()}_handleButtonClick(e){var t;this._isHidden?(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.showApp(),null===(t=this.rootEl.querySelector('[role="application"]'))||void 0===t||t.focus()):this._root||(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.loadApp({focusOnMount:!0}))}_removeMapParamFromUrl(e,t){var i=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return i.test(e)?e.replace(i,(e,t)=>"&"===t?"?":"").replace(/\?$/,""):e}_handleExitClick(){var e;if(this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack){if(this._isClosingViaBack)return;this._isClosingViaBack=!0,history.back(),setTimeout(()=>{this._isClosingViaBack=!1},1e3)}else{this.config.preserveStateOnClose?this.hideApp():this.removeApp();var t=this.config.mapViewQueryParam,i=this._removeMapParamFromUrl(location.href,t);history.replaceState(history.state,"",i)}else this.config.preserveStateOnClose?this.hideApp():this.removeApp()}loadApp(){var t=arguments,i=this;return e(function*(){var{focusOnMount:n=!1}=t.length>0&&void 0!==t[0]?t[0]:{};if(!i._root&&!i._isLoading){i._isLoading=!0,i._openButton&&(i._openButton.style.display="none");try{var{initialiseApp:r}=yield import(/* webpackChunkName: "im-core" */ "./im-core.js"),{MapProvider:o,mapFramework:a,mapProviderConfig:s}=yield i.config.mapProvider.load();i.config.reverseGeocodeProvider&&function(t,i){var{url:n,transformRequest:r,load:o}=t;I=function(){var t=e(function*(e,t){return(yield o())(n,r,i,e,t)});return function(e,i){return t.apply(this,arguments)}}()}(i.config.reverseGeocodeProvider,s.crs);var l=yield r(i.rootEl,Q(Q({id:i.id,initialBreakpoint:i._breakpointDetector.getBreakpoint(),initialInterfaceType:C(),focusOnMount:n},i.config),{},{MapProvider:o,mapProviderConfig:s,mapFramework:a,eventBus:i.eventBus,breakpointDetector:i._breakpointDetector,handleExitClick:i._handleExitClick.bind(i)}));i._root=l._root,delete l._root;var c=new Set(["on","off","emit"]);Object.keys(l).forEach(e=>{c.has(e)||(i[e]=l[e])});var{isFullscreen:u}=f(i);i.eventBus.emit(A.APP_OPENED,{statePreserved:!1,isFullscreen:u})}catch(e){var d;throw null===(d=i._openButton)||void 0===d||d.removeAttribute("style"),h(i.rootEl,i.config.genericErrorText),console.error(e),e}finally{i._isLoading=!1}}})()}removeApp(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),f(this,{isFullscreen:!1}),this.eventBus.emit(A.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(A.MAP_DESTROY,{mapId:this.id})}hideApp(){this._isHidden=!0,this.rootEl.style.display="none",m({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(A.APP_CLOSED,{statePreserved:!0})}showApp(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none");var{isFullscreen:e}=f(this);this.eventBus.emit(A.APP_OPENED,{statePreserved:!0,isFullscreen:e})}destroy(){var e,t,i;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(i=this._hybridBehaviourCleanup)||void 0===i||i.call(this),c.unregister(this),this.eventBus.destroy()}on(){this.eventBus.on(...arguments)}off(){this.eventBus.off(...arguments)}emit(){this.eventBus.emit(...arguments)}addMarker(e,t,i){this.eventBus.emit(A.APP_ADD_MARKER,{id:e,coords:t,options:i})}updateMarker(e,t){this.eventBus.emit(A.APP_UPDATE_MARKER,{id:e,options:t})}removeMarker(e){this.eventBus.emit(A.APP_REMOVE_MARKER,e)}addButton(e,t){this.eventBus.emit(A.APP_ADD_BUTTON,{id:e,config:t})}toggleButtonState(e,t,i){this.eventBus.emit(A.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:i})}setContinueEnabled(e){this.toggleButtonState("journeyContinue","disabled",!e)}addPanel(e,t){this.eventBus.emit(A.APP_ADD_PANEL,{id:e,config:t})}removePanel(e){this.eventBus.emit(A.APP_REMOVE_PANEL,e)}showPanel(e){var{focus:t=!0,triggeringElement:i}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null!=i?i:document.activeElement&&document.activeElement!==document.body?document.activeElement:void 0;this.eventBus.emit(A.APP_SHOW_PANEL,{id:e,focus:t,triggeringElement:n})}hidePanel(e){this.eventBus.emit(A.APP_HIDE_PANEL,e)}setApplicationMode(e){var{include:t=null,exclude:i=null}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.eventBus.emit(A.APP_SET_APPLICATION_MODE,{id:e,include:t,exclude:i})}clearApplicationMode(e){this.eventBus.emit(A.APP_CLEAR_APPLICATION_MODE,e)}addControl(e,t){this.eventBus.emit(A.APP_ADD_CONTROL,{id:e,config:t})}showHint(e,t){this.eventBus.emit(A.APP_SHOW_HINT,{text:e,options:t})}dismissHint(){this.eventBus.emit(A.APP_DISMISS_HINT)}fitToBounds(e){this.eventBus.emitWhenReady(A.MAP_FIT_TO_BOUNDS,e)}setView(e){this.eventBus.emitWhenReady(A.MAP_SET_VIEW,e)}open(){this._isHidden?this.showApp():this._root||this.loadApp()}close(){this._handleExitClick()}}export{A as E,Y as I,C as a,b,o as g,j as h,_ as l,N as r,R as s,m as t};
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import t from"@babel/runtime/helpers/toConsumableArray";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/regenerator";import r from"@babel/runtime/helpers/asyncToGenerator";import a from"@babel/runtime/helpers/objectWithoutProperties";import s from"@babel/runtime/helpers/createForOfIteratorHelper";import u from"@babel/runtime/helpers/objectSpread2";var l=["mapViewParamKey"],c=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null===(t=window.location)||void 0===t?void 0:t.search;return new URLSearchParams(n).get(e)},d=function(e){var t=e.behaviour,n=e.hybridWidth,i=e.maxMobileWidth;if("hybrid"!==t)return!1;var o=null!=n?n:i;return window.matchMedia("(max-width: ".concat(o,"px)")).matches},p=function(e){var t=e.behaviour;return["mapOnly","buttonFirst"].includes(t)||d(e)};function h(){v.forEach(function(e){!function(e,t){var n;if(!1!==e.config.manageHistoryState){e._isClosingViaBack=!1;var i=e.id===t,o="hybrid"===e.config.behaviour&&!d(e.config),r=null===(n=e.rootEl)||void 0===n?void 0:n.children.length;!i||r&&!e._isHidden?i||!r||o||function(e){var t,n;e.config.preserveStateOnClose?null===(t=e.hideApp)||void 0===t||t.call(e):null===(n=e.removeApp)||void 0===n||n.call(e)}(e):function(e){var t,n;e._isHidden?null===(t=e.showApp)||void 0===t||t.call(e):null===(n=e.loadApp)||void 0===n||n.call(e)}(e)}}(e,c(e.config.mapViewQueryParam))})}var v=new Map,f=!1;var m={register:function(e){f||(globalThis.addEventListener("popstate",h),f=!0),v.set(e.id,e)},unregister:function(e){v.delete(e.id),0===v.size&&(globalThis.removeEventListener("popstate",h),f=!1)}};function _(e){try{return JSON.parse(e)}catch(t){return e}}function y(e,t){e.innerHTML='<div class="im-c-error">'.concat(t,"</div>")}var b=function(e,t,n,i){return e!==t&&!(null!=n&&n.contains(e))&&e.matches(":not([aria-hidden]):not([data-fm-inert])")&&i.contains(e)};function A(e){var t,n=e.containerEl,i=e.isFullscreen,o=e.boundaryEl,r=void 0===o?document.body:o,a=Array.from(r.querySelectorAll("[data-fm-inert]"));if(n&&(a=a.filter(function(e){return!n.contains(e)})),a.forEach(function(e){e.removeAttribute("aria-hidden"),delete e.dataset.fmInert}),i){null===(t=document.activeElement)||void 0===t||t.blur();for(var u=n;null!==(l=u)&&void 0!==l&&l.parentNode&&u!==r&&u!==document.body;){var l,c,d=u.parentNode,p=s(d.children);try{for(p.s();!(c=p.n()).done;){var h=c.value;b(h,u,n,r)&&(h.setAttribute("aria-hidden","true"),h.dataset.fmInert="")}}catch(e){p.e(e)}finally{p.f()}u=d}}}function P(e){var t=e.id,n=e.behaviour,i=e.manageHistoryState;return"mapOnly"===n||("buttonFirst"===n?!1===i||c(e.mapViewQueryParam)===t:d(e)&&c(e.mapViewQueryParam)===t)}function E(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).isFullscreen,n=e.config,i=e.rootEl,o=n.pageTitle,r=n.behaviour,a=n.containerHeight,s=null!=t?t:P(n);["mapOnly","buttonFirst","hybrid"].includes(r)&&(A({containerEl:i,isFullscreen:s}),document.documentElement.classList.toggle("im-is-fullscreen",s),i.classList.toggle("im-is-fullscreen",s)),["buttonFirst","hybrid"].includes(r)&&function(e){var t=e.pageTitle,n=e.isFullscreen,i=document.title.split(": "),o=i[i.length-1];document.title=n?"".concat(t,": ").concat(o):o}({pageTitle:o,isFullscreen:s});var u=s||"buttonFirst"!==r&&!d(n)?a:"auto";return i.style.height=s?"100%":u,{isFullscreen:s}}function g(){document.body.classList.remove("im-is-loading")}var w="[interactive-map]",k={warn:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).warn.apply(e,[w].concat(n))},error:function(){for(var e,t=arguments.length,n=new Array(t),i=0;i<t;i++)n[i]=arguments[i];return(e=console).error.apply(e,[w].concat(n))}};var T={APP_ADD_MARKER:"app:addmarker",APP_UPDATE_MARKER:"app:updatemarker",APP_REMOVE_MARKER:"app:removemarker",APP_ADD_BUTTON:"app:addbutton",APP_TOGGLE_BUTTON_STATE:"app:togglebuttonstate",APP_ADD_PANEL:"app:addpanel",APP_REMOVE_PANEL:"app:removepanel",APP_SHOW_PANEL:"app:showpanel",APP_HIDE_PANEL:"app:hidepanel",APP_ADD_CONTROL:"app:addcontrol",APP_SET_APPLICATION_MODE:"app:setapplicationmode",APP_CLEAR_APPLICATION_MODE:"app:clearapplicationmode",APP_SHOW_HINT:"app:showhint",APP_DISMISS_HINT:"app:dismisshint",APP_READY:"app:ready",APP_OPENED:"app:opened",APP_CLOSED:"app:closed",APP_FULLSCREEN_CHANGE:"app:fullscreenchange",APP_PANEL_OPENED:"app:panelopened",APP_PANEL_CLOSED:"app:panelclosed",MAP_SET_STYLE:"map:setstyle",MAP_SET_SIZE:"map:setsize",MAP_SET_SPATIAL_LIST:"map:setspatiallist",MAP_SET_SPATIAL_LIST_SUPPRESSED:"map:setspatiallistsuppressed",MAP_SET_ACTIVE_ITEM:"map:setactiveitem",MAP_SELECT_ITEM:"map:selectitem",MAP_SET_PIXEL_RATIO:"map:setpixelratio",MAP_FIT_TO_BOUNDS:"map:fittobounds",MAP_SET_VIEW:"map:setview",MAP_INIT_MAP_STYLES:"map:initmapstyles",MAP_STYLE_CHANGE:"map:stylechange",MAP_LOADED:"map:loaded",MAP_READY:"map:ready",MAP_SIZE_CHANGE:"map:sizechange",MAP_FIRST_IDLE:"map:firstidle",MAP_MOVE_START:"map:movestart",MAP_MOVE:"map:move",MAP_MOVE_END:"map:moveend",MAP_STATE_UPDATED:"map:stateupdated",MAP_DATA_CHANGE:"map:datachange",MAP_RENDER:"map:render",MAP_CLICK:"map:click",MAP_DESTROY:"map:destroy"};function S(e){var t=e.id,n=e.behaviour,i=c(e.mapViewQueryParam)===t;return["mapOnly","inline"].includes(n)||"hybrid"===n&&!d(e)||i}var O={appColorScheme:"light",autoColorScheme:!1,backgroundColor:"var(--background-color)",behaviour:"buttonFirst",buttonClass:"im-c-open-map-button",buttonText:"Map view",containerHeight:"600px",deviceNotSupportedText:"Your device is not supported. A map is available with a more up-to-date browser or device.",enableFullscreen:!1,enableMapControls:!0,enableZoomControls:!0,genericErrorText:"There was a problem loading the map. Please try again later.",hasExitButton:!1,backAndContinue:null,hybridWidth:null,keyboardHintText:'<span class="im-u-visually-hidden">Press </span><kbd>Shift</kbd> + <span class="im-u-visually-hidden">Question mark</span><kbd aria-hidden="true">?</kbd> <span class="im-u-visually-hidden">to view </span>keyboard shortcuts',mapHintText:"Press Tab to focus it. Keyboard commands are only available once it has focus.",mapLabel:"Interactive map application",mapProvider:null,mapSize:"small",manageHistoryState:!0,mapViewQueryParam:"mv",urlPosition:"sync",maxMobileWidth:640,minDesktopWidth:835,mapControlsHintText:'A "map controls" button is also available, opening further controls for moving and zooming.',nudgePanDelta:5,nudgeZoomDelta:.1,panDelta:100,pageTitle:"Map view",preserveStateOnClose:!1,readMapText:!1,reverseGeocodeProvider:null,zoomDelta:1};function M(e){var t,n=e.maxMobileWidth,i=e.minDesktopWidth,o=e.containerEl,r="unknown",a=new Set,s=function(e){e!==r&&(r=e,requestAnimationFrame(function(){r===e&&a.forEach(function(t){return t(e)})}))};if(o){var u=function(e,t,n){e.style.containerType="inline-size";var i=e.getBoundingClientRect().width,o=t(i);e.dataset.breakpoint=o;var r=new window.ResizeObserver(function(i){var o,r,a=(null===(o=i[0])||void 0===o||null===(o=o.borderBoxSize)||void 0===o||null===(o=o[0])||void 0===o?void 0:o.inlineSize)||(null===(r=i[0])||void 0===r?void 0:r.contentRect.width),s=t(a);e.dataset.breakpoint=s,n(s)});return r.observe(e),{initialType:o,cleanup:function(){r.disconnect(),e.style.containerType="",delete e.dataset.breakpoint}}}(o,function(e){return function(e,t,n){return e<=t?"mobile":e>=n?"desktop":"tablet"}(e,n,i)},s);r=u.initialType,s(u.initialType),t=u.cleanup}else{var l=function(e,t,n){var i={mobile:window.matchMedia("(max-width: ".concat(e,"px)")),desktop:window.matchMedia("(min-width: ".concat(t,"px)"))},o=function(){var e="tablet";i.mobile.matches?e="mobile":i.desktop.matches&&(e="desktop"),n(e)};return i.mobile.addEventListener("change",o),i.desktop.addEventListener("change",o),o(),{cleanup:function(){i.mobile.removeEventListener("change",o),i.desktop.removeEventListener("change",o)}}}(n,i,s);t=l.cleanup}return{subscribe:function(e){return a.add(e),function(){return a.delete(e)}},getBreakpoint:function(){return r},destroy:function(){var e;null===(e=t)||void 0===e||e(),a.clear()}}}var B=window.matchMedia("(pointer: coarse)").matches?"touch":"unknown",L=new Set,x=new Set;var C=new Set(["Enter","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Escape"]),D=new Set(["button","checkbox","color","file","image","radio","range","reset","submit"]);function R(e){B!==e&&(B=e,x.forEach(function(t){return t(e)}),L.forEach(function(t){return t(e)}))}function I(){var e=window.matchMedia("(pointer: coarse)"),t=function(e){R(e.matches?"touch":"mouse")};e.addEventListener("change",t);var n=function(e){var t,n="pen"===(t=e.pointerType)||"touch"===t?"touch":"mouse"===t?"mouse":"unknown";n!==B&&(B=n,x.forEach(function(e){return e(n)}),setTimeout(function(){L.forEach(function(e){return e(n)})},150))},i=function(e){var t;("Tab"===e.key||C.has(e.key)&&(!(t=e.target)||"TEXTAREA"!==t.tagName&&!t.isContentEditable&&("INPUT"!==t.tagName||D.has(t.type))))&&R("keyboard")};return window.addEventListener("pointerdown",n,{passive:!0}),window.addEventListener("keydown",i,{passive:!0}),function(){e.removeEventListener("change",t),window.removeEventListener("pointerdown",n),window.removeEventListener("keydown",i)}}function N(){return"unknown"===B?(B="mouse","mouse"):B}function H(e){return L.add(e),function(){L.delete(e)}}var F=null;function U(e,t){var n=e.url,i=e.transformRequest,a=e.load;F=function(){var e=r(o().m(function e(r,s){var u;return o().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,a();case 1:return u=e.v,e.a(2,u(n,i,t,r,s))}},e)}));return function(t,n){return e.apply(this,arguments)}}()}function V(){return null!==F}function W(e,t){if(!F)throw new Error("ReverseGeocode not initialised");return F(e,t)}var j=function(){return i(function e(){n(this,e),this.events={},this._queued={}},[{key:"on",value:function(e,n){if(this.events[e]||(this.events[e]=[]),this.events[e].push(n),void 0!==this._queued[e]){try{n.apply(void 0,t(this._queued[e]))}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}delete this._queued[e]}return this}},{key:"once",value:function(e,t){var n=this,i=function(){n.off(e,i),t.apply(void 0,arguments)};return this.on(e,i)}},{key:"off",value:function(e,t){return this.events[e]?(this.events[e]=t?this.events[e].filter(function(e){return e!==t}):[],this):this}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]?(this.events[e].forEach(function(t){try{t.apply(void 0,n)}catch(t){console.error("Error in event handler for '".concat(e,"':"),t)}}),this):this}},{key:"emitWhenReady",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return this.events[e]&&0!==this.events[e].length?this.emit.apply(this,[e].concat(n)):(this._queued[e]=n,this)}},{key:"emitWhenRequested",value:function(e){for(var t=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];var r="".concat(e,"Requested"),a="".concat(e,"Ready"),s=function(){return t.emit.apply(t,[a].concat(i))};return this.on(r,s),s(),function(){return t.off(r,s)}}},{key:"requestOnce",value:function(e,t){var n="".concat(e,"Requested"),i="".concat(e,"Ready");return this.once(i,t),this.emit(n,e),this}},{key:"destroy",value:function(){this.events={},this._queued={}}}])}();if("undefined"!=typeof crypto&&!crypto.randomUUID){var q=0;crypto.randomUUID=function(){return q=Math.max(Date.now(),q+1),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e,t){var n=t<12?Number.parseInt(q.toString(16).padStart(12,"0")[t],16):16*Math.random()|0;return("x"===e?n:3&n|8).toString(16)})}}var z=!Object.hasOwn;z&&(Object.hasOwn=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)});var G="undefined"!=typeof AbortController&&!Object.getPrototypeOf((new AbortController).signal).throwIfAborted;G&&(Object.getPrototypeOf((new AbortController).signal).throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");throw e.name="AbortError",e}});if((G||z)&&"undefined"!=typeof URL&&URL.createObjectURL){var K="text/javascript",Q=["if(!Object.hasOwn){Object.hasOwn=function(o,k){return Object.prototype.hasOwnProperty.call(o,k)}}\n",G?'if(typeof AbortController!=="undefined"){var _p=Object.getPrototypeOf(new AbortController().signal);if(!_p.throwIfAborted){_p.throwIfAborted=function(){if(this.aborted){var e=new Error("The operation was aborted.");e.name="AbortError";throw e}}}}\n':""].join(""),Y=URL.createObjectURL.bind(URL);if(URL.createObjectURL=function(e){return e instanceof Blob&&e.type===K&&(e=new Blob([Q,e],{type:K})),Y(e)},"undefined"!=typeof Worker){var Z=Worker;Worker=function(e,t){if("string"==typeof e&&!e.startsWith("blob:")&&"module"!==(null==t?void 0:t.type)){var n=new Blob(["".concat(Q,"importScripts(").concat(JSON.stringify(e),")")],{type:K});e=Y(n)}return new Z(e,t)},Worker.prototype=Z.prototype}}var J=function(){return i(function t(i){var o,r,a,s,u,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,t),e(this,"_openButton",null),e(this,"_root",null),e(this,"_breakpointDetector",null),e(this,"_interfaceDetectorCleanup",null),e(this,"_hybridBehaviourCleanup",null),e(this,"_isHidden",!1),e(this,"_isClosingViaBack",!1),e(this,"_isLoading",!1),this.id=i,this.rootEl=document.getElementById(i),!this.rootEl)throw new Error('Element with id "'.concat(i,'" not found'));this.eventBus=new j,this.config=this._buildConfig(l),o=this.rootEl,r=this.config,a=r.mapProvider,s=r.deviceNotSupportedText,u=null==a?void 0:a.checkDeviceCapabilities(),(a?null!=u&&u.isSupported||(y(o,s),g(),k.warn(null==u?void 0:u.error),0):(k.warn("No map provider"),0))&&(["buttonFirst","hybrid"].includes(this.config.behaviour)&&m.register(this),this._breakpointDetector=M({maxMobileWidth:this.config.maxMobileWidth,minDesktopWidth:this.config.minDesktopWidth,containerEl:this.rootEl}),this._interfaceDetectorCleanup=I(),this._initialize())},[{key:"_buildConfig",value:function(e){var t=function(e){for(var t=u({},null==e?void 0:e.dataset),n={},i=0,o=Object.keys(t);i<o.length;i++){var r=o[i];n[r]=_(t[r])}return n}(this.rootEl);return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mapViewParamKey,n=a(e,l),i=u(u({},O),n);return void 0!==t&&(console.warn("[InteractiveMap] mapViewParamKey is deprecated — use mapViewQueryParam instead."),i.mapViewQueryParam=t),"mapOnly"===i.behaviour&&i.hasExitButton&&(console.warn("[InteractiveMap] hasExitButton has no effect when behaviour is 'mapOnly' — there is nothing to exit to."),i.hasExitButton=!1),i}(u(u({id:this.id,title:document.title},t),e))}},{key:"_initialize",value:function(){var e,t=this;["buttonFirst","hybrid"].includes(this.config.behaviour)&&(this._openButton=function(e,t,n){var i=e.id,o=e.buttonText,r=e.buttonClass,a='\n <a class="'.concat(r,"\" role=\"button\">\n <svg focusable='false' aria-hidden='true' width='16' height='20' viewBox='0 0 16 20' fillRule='evenodd'>\n <path d='M15 7.5c.009 3.778-4.229 9.665-7.5 12.5C4.229 17.165-.009 11.278 0 7.5a7.5 7.5 0 1 1 15 0z'/>\n <path d='M7.5 12.961a5.46 5.46 0 1 0 0-10.922 5.46 5.46 0 1 0 0 10.922z' fill='#fff'/>\n </svg>\n <span>").concat(o,"</span>\n <span class='im-u-visually-hidden'> (Visual only)</span>\n </a>\n ");t.insertAdjacentHTML("beforebegin",a);var s=t.previousElementSibling,u=new URL(window.location.href);return u.searchParams.set(e.mapViewQueryParam,i),s.setAttribute("href",u.toString()),s.addEventListener("click",function(e){e.preventDefault(),n(e)}),s}(this.config,this.rootEl,function(e){t._handleButtonClick(e)})),this._hybridBehaviourCleanup=function(e){var t=e.config,n=t.behaviour,i=t.hybridWidth,o=t.maxMobileWidth;if("buttonFirst"===n&&e._breakpointDetector.subscribe(function(){S(e.config)?e.loadApp():e.removeApp()}),"hybrid"===n){var r=null!=i?i:o,a=window.matchMedia("(max-width: ".concat(r,"px)")),s=function(){if(S(e.config))if(e._isHidden)e.showApp();else if(null==e._root)e.loadApp();else{var t=E(e).isFullscreen;e.eventBus.emit(T.APP_FULLSCREEN_CHANGE,{isFullscreen:t})}else e._root&&e.hideApp()};return a.addEventListener("change",s),function(){return a.removeEventListener("change",s)}}return null}(this),S(this.config)?(P((e=this).config)||(E(e,{isFullscreen:!1}),g()),this.loadApp()):g()}},{key:"_handleButtonClick",value:function(e){var t;this._isHidden?(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.showApp(),null===(t=this.rootEl.querySelector('[role="application"]'))||void 0===t||t.focus()):this._root||(this.config.manageHistoryState&&history.pushState({isBack:!0},"",e.currentTarget.getAttribute("href")),this.loadApp({focusOnMount:!0}))}},{key:"_removeMapParamFromUrl",value:function(e,t){var n=new RegExp("[?&]".concat(t,"=[^&]*(&|$)"));return n.test(e)?e.replace(n,function(e,t){return"&"===t?"?":""}).replace(/\?$/,""):e}},{key:"_handleExitClick",value:function(){var e,t=this;if(this.config.manageHistoryState)if(null!==(e=history.state)&&void 0!==e&&e.isBack){if(this._isClosingViaBack)return;this._isClosingViaBack=!0,history.back(),setTimeout(function(){t._isClosingViaBack=!1},1e3)}else{this.config.preserveStateOnClose?this.hideApp():this.removeApp();var n=this.config.mapViewQueryParam,i=this._removeMapParamFromUrl(location.href,n);history.replaceState(history.state,"",i)}else this.config.preserveStateOnClose?this.hideApp():this.removeApp()}},{key:"loadApp",value:(t=r(o().m(function e(){var t,n,i,r,a,s,l,c,d,p,h,v,f,m,_=this,b=arguments;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(t=(b.length>0&&void 0!==b[0]?b[0]:{}).focusOnMount,n=void 0!==t&&t,!this._root&&!this._isLoading){e.n=1;break}return e.a(2);case 1:return this._isLoading=!0,this._openButton&&(this._openButton.style.display="none"),e.p=2,e.n=3,import(/* webpackChunkName: "im-core" */ "./im-core.js");case 3:return i=e.v,r=i.initialiseApp,e.n=4,this.config.mapProvider.load();case 4:return a=e.v,s=a.MapProvider,l=a.mapFramework,c=a.mapProviderConfig,this.config.reverseGeocodeProvider&&U(this.config.reverseGeocodeProvider,c.crs),e.n=5,r(this.rootEl,u(u({id:this.id,initialBreakpoint:this._breakpointDetector.getBreakpoint(),initialInterfaceType:N(),focusOnMount:n},this.config),{},{MapProvider:s,mapProviderConfig:c,mapFramework:l,eventBus:this.eventBus,breakpointDetector:this._breakpointDetector,handleExitClick:this._handleExitClick.bind(this)}));case 5:d=e.v,this._root=d._root,delete d._root,p=new Set(["on","off","emit"]),Object.keys(d).forEach(function(e){p.has(e)||(_[e]=d[e])}),h=E(this),v=h.isFullscreen,this.eventBus.emit(T.APP_OPENED,{statePreserved:!1,isFullscreen:v}),e.n=7;break;case 6:throw e.p=6,m=e.v,null===(f=this._openButton)||void 0===f||f.removeAttribute("style"),y(this.rootEl,this.config.genericErrorText),console.error(m),m;case 7:return e.p=7,this._isLoading=!1,e.f(7);case 8:return e.a(2)}},e,this,[[2,6,7,8]])})),function(){return t.apply(this,arguments)})},{key:"removeApp",value:function(){this._root&&"function"==typeof this.unmount&&(this.unmount(),this._root=null),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),E(this,{isFullscreen:!1}),this.eventBus.emit(T.APP_CLOSED,{statePreserved:!1}),this.eventBus.emit(T.MAP_DESTROY,{mapId:this.id})}},{key:"hideApp",value:function(){this._isHidden=!0,this.rootEl.style.display="none",A({containerEl:this.rootEl,isFullscreen:!1}),this._openButton&&(this._openButton.removeAttribute("style"),this._openButton.focus()),document.documentElement.classList.remove("im-is-fullscreen"),this.rootEl.classList.remove("im-is-fullscreen");var e=document.title.split(": ");e.length>1&&(document.title=e.at(-1)),this.eventBus.emit(T.APP_CLOSED,{statePreserved:!0})}},{key:"showApp",value:function(){this._isHidden=!1,this.rootEl.style.display="",this._openButton&&(this._openButton.style.display="none");var e=E(this).isFullscreen;this.eventBus.emit(T.APP_OPENED,{statePreserved:!0,isFullscreen:e})}},{key:"destroy",value:function(){var e,t,n;this.removeApp(),null===(e=this._breakpointDetector)||void 0===e||e.destroy(),null===(t=this._interfaceDetectorCleanup)||void 0===t||t.call(this),null===(n=this._hybridBehaviourCleanup)||void 0===n||n.call(this),m.unregister(this),this.eventBus.destroy()}},{key:"on",value:function(){var e;(e=this.eventBus).on.apply(e,arguments)}},{key:"off",value:function(){var e;(e=this.eventBus).off.apply(e,arguments)}},{key:"emit",value:function(){var e;(e=this.eventBus).emit.apply(e,arguments)}},{key:"addMarker",value:function(e,t,n){this.eventBus.emit(T.APP_ADD_MARKER,{id:e,coords:t,options:n})}},{key:"updateMarker",value:function(e,t){this.eventBus.emit(T.APP_UPDATE_MARKER,{id:e,options:t})}},{key:"removeMarker",value:function(e){this.eventBus.emit(T.APP_REMOVE_MARKER,e)}},{key:"addButton",value:function(e,t){this.eventBus.emit(T.APP_ADD_BUTTON,{id:e,config:t})}},{key:"toggleButtonState",value:function(e,t,n){this.eventBus.emit(T.APP_TOGGLE_BUTTON_STATE,{id:e,prop:t,value:n})}},{key:"setContinueEnabled",value:function(e){this.toggleButtonState("journeyContinue","disabled",!e)}},{key:"addPanel",value:function(e,t){this.eventBus.emit(T.APP_ADD_PANEL,{id:e,config:t})}},{key:"removePanel",value:function(e){this.eventBus.emit(T.APP_REMOVE_PANEL,e)}},{key:"showPanel",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.focus,i=void 0===n||n,o=t.triggeringElement,r=null!=o?o:document.activeElement&&document.activeElement!==document.body?document.activeElement:void 0;this.eventBus.emit(T.APP_SHOW_PANEL,{id:e,focus:i,triggeringElement:r})}},{key:"hidePanel",value:function(e){this.eventBus.emit(T.APP_HIDE_PANEL,e)}},{key:"setApplicationMode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.include,i=void 0===n?null:n,o=t.exclude,r=void 0===o?null:o;this.eventBus.emit(T.APP_SET_APPLICATION_MODE,{id:e,include:i,exclude:r})}},{key:"clearApplicationMode",value:function(e){this.eventBus.emit(T.APP_CLEAR_APPLICATION_MODE,e)}},{key:"addControl",value:function(e,t){this.eventBus.emit(T.APP_ADD_CONTROL,{id:e,config:t})}},{key:"showHint",value:function(e,t){this.eventBus.emit(T.APP_SHOW_HINT,{text:e,options:t})}},{key:"dismissHint",value:function(){this.eventBus.emit(T.APP_DISMISS_HINT)}},{key:"fitToBounds",value:function(e){this.eventBus.emitWhenReady(T.MAP_FIT_TO_BOUNDS,e)}},{key:"setView",value:function(e){this.eventBus.emitWhenReady(T.MAP_SET_VIEW,e)}},{key:"open",value:function(){this._isHidden?this.showApp():this._root||this.loadApp()}},{key:"close",value:function(){this._handleExitClick()}}]);var t}();export{T as E,J as I,N as a,g as b,p as g,V as h,k as l,W as r,H as s,A as t};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{E as EVENTS,I as InteractiveMap,I as default}from"./im-shell.js";
|
|
1
|
+
export{E as EVENTS,I as InteractiveMap,I as default}from"./im-shell.js";
|