@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
|
@@ -1,106 +1,107 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
let cleanup = null
|
|
5
|
-
|
|
6
|
-
const getBreakpointType = (width) => {
|
|
7
|
-
if (width <= maxMobileWidth) {
|
|
8
|
-
return 'mobile'
|
|
9
|
-
}
|
|
10
|
-
if (width >= minDesktopWidth) {
|
|
11
|
-
return 'desktop'
|
|
12
|
-
}
|
|
13
|
-
return 'tablet'
|
|
1
|
+
function getBreakpointType (width, maxMobileWidth, minDesktopWidth) {
|
|
2
|
+
if (width <= maxMobileWidth) {
|
|
3
|
+
return 'mobile'
|
|
14
4
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (type !== lastBreakpoint) {
|
|
18
|
-
lastBreakpoint = type // Set synchronously BEFORE RAF
|
|
19
|
-
requestAnimationFrame(() => {
|
|
20
|
-
// Double-check it hasn't changed again
|
|
21
|
-
if (lastBreakpoint === type) {
|
|
22
|
-
listeners.forEach(fn => fn(type))
|
|
23
|
-
}
|
|
24
|
-
})
|
|
25
|
-
}
|
|
5
|
+
if (width >= minDesktopWidth) {
|
|
6
|
+
return 'desktop'
|
|
26
7
|
}
|
|
8
|
+
return 'tablet'
|
|
9
|
+
}
|
|
27
10
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
containerEl.style.containerType = 'inline-size'
|
|
31
|
-
|
|
32
|
-
// Set initial detection BEFORE observing to prevent double notification
|
|
33
|
-
const initialWidth = containerEl.getBoundingClientRect().width
|
|
34
|
-
const initialType = getBreakpointType(initialWidth)
|
|
35
|
-
containerEl.setAttribute('data-breakpoint', initialType)
|
|
36
|
-
lastBreakpoint = initialType // Set this directly, don't notify yet
|
|
11
|
+
function createContainerDetector (containerEl, getType, notifyListeners) {
|
|
12
|
+
containerEl.style.containerType = 'inline-size'
|
|
37
13
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
containerEl.setAttribute('data-breakpoint', type)
|
|
42
|
-
notifyListeners(type)
|
|
43
|
-
})
|
|
14
|
+
const initialWidth = containerEl.getBoundingClientRect().width
|
|
15
|
+
const initialType = getType(initialWidth)
|
|
16
|
+
containerEl.dataset.breakpoint = initialType
|
|
44
17
|
|
|
45
|
-
|
|
18
|
+
const observer = new window.ResizeObserver((entries) => {
|
|
19
|
+
const width = entries[0]?.borderBoxSize?.[0]?.inlineSize || entries[0]?.contentRect.width
|
|
20
|
+
const type = getType(width)
|
|
21
|
+
containerEl.dataset.breakpoint = type
|
|
22
|
+
notifyListeners(type)
|
|
23
|
+
})
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
notifyListeners(initialType)
|
|
25
|
+
observer.observe(containerEl)
|
|
49
26
|
|
|
50
|
-
|
|
27
|
+
return {
|
|
28
|
+
initialType,
|
|
29
|
+
cleanup: () => {
|
|
51
30
|
observer.disconnect()
|
|
52
31
|
containerEl.style.containerType = ''
|
|
53
|
-
containerEl.
|
|
32
|
+
delete containerEl.dataset.breakpoint
|
|
54
33
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const mq = {
|
|
58
|
-
mobile: window.matchMedia(`(max-width: ${maxMobileWidth}px)`),
|
|
59
|
-
desktop: window.matchMedia(`(min-width: ${minDesktopWidth}px)`)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const detect = () => {
|
|
63
|
-
let type
|
|
34
|
+
}
|
|
35
|
+
}
|
|
64
36
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
type = 'tablet'
|
|
71
|
-
}
|
|
37
|
+
function createViewportDetector (maxMobileWidth, minDesktopWidth, notifyListeners) {
|
|
38
|
+
const mq = {
|
|
39
|
+
mobile: window.matchMedia(`(max-width: ${maxMobileWidth}px)`),
|
|
40
|
+
desktop: window.matchMedia(`(min-width: ${minDesktopWidth}px)`)
|
|
41
|
+
}
|
|
72
42
|
|
|
73
|
-
|
|
43
|
+
const detect = () => {
|
|
44
|
+
let type = 'tablet'
|
|
45
|
+
if (mq.mobile.matches) {
|
|
46
|
+
type = 'mobile'
|
|
47
|
+
} else if (mq.desktop.matches) {
|
|
48
|
+
type = 'desktop'
|
|
49
|
+
} else {
|
|
50
|
+
// No action
|
|
74
51
|
}
|
|
52
|
+
notifyListeners(type)
|
|
53
|
+
}
|
|
75
54
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
mq.mobile.addEventListener('change', detect)
|
|
56
|
+
mq.desktop.addEventListener('change', detect)
|
|
57
|
+
detect()
|
|
79
58
|
|
|
80
|
-
|
|
59
|
+
return {
|
|
60
|
+
cleanup: () => {
|
|
81
61
|
mq.mobile.removeEventListener('change', detect)
|
|
82
62
|
mq.desktop.removeEventListener('change', detect)
|
|
83
63
|
}
|
|
84
64
|
}
|
|
65
|
+
}
|
|
85
66
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
67
|
+
function createBreakpointDetector ({ maxMobileWidth, minDesktopWidth, containerEl }) {
|
|
68
|
+
let lastBreakpoint = 'unknown'
|
|
69
|
+
const listeners = new Set()
|
|
90
70
|
|
|
91
|
-
const
|
|
92
|
-
|
|
71
|
+
const notifyListeners = (type) => {
|
|
72
|
+
if (type !== lastBreakpoint) {
|
|
73
|
+
lastBreakpoint = type
|
|
74
|
+
requestAnimationFrame(() => {
|
|
75
|
+
if (lastBreakpoint === type) {
|
|
76
|
+
listeners.forEach(fn => fn(type))
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
93
80
|
}
|
|
94
81
|
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
82
|
+
const getType = (width) => getBreakpointType(width, maxMobileWidth, minDesktopWidth)
|
|
83
|
+
|
|
84
|
+
let cleanup
|
|
85
|
+
if (containerEl) {
|
|
86
|
+
const detector = createContainerDetector(containerEl, getType, notifyListeners)
|
|
87
|
+
lastBreakpoint = detector.initialType
|
|
88
|
+
notifyListeners(detector.initialType)
|
|
89
|
+
cleanup = detector.cleanup
|
|
90
|
+
} else {
|
|
91
|
+
const detector = createViewportDetector(maxMobileWidth, minDesktopWidth, notifyListeners)
|
|
92
|
+
cleanup = detector.cleanup
|
|
98
93
|
}
|
|
99
94
|
|
|
100
95
|
return {
|
|
101
|
-
subscribe
|
|
102
|
-
|
|
103
|
-
|
|
96
|
+
subscribe: (fn) => {
|
|
97
|
+
listeners.add(fn)
|
|
98
|
+
return () => listeners.delete(fn)
|
|
99
|
+
},
|
|
100
|
+
getBreakpoint: () => lastBreakpoint,
|
|
101
|
+
destroy: () => {
|
|
102
|
+
cleanup?.()
|
|
103
|
+
listeners.clear()
|
|
104
|
+
}
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
|
|
@@ -12,7 +12,7 @@ let mockedQueries = {}
|
|
|
12
12
|
|
|
13
13
|
class MockResizeObserver {
|
|
14
14
|
constructor (callback) { this.callback = callback }
|
|
15
|
-
observe (
|
|
15
|
+
observe () { MockResizeObserver.instance = this }
|
|
16
16
|
disconnect () { MockResizeObserver.instance = null }
|
|
17
17
|
trigger (width, fallback) {
|
|
18
18
|
this.callback([fallback ? { contentRect: { width } } : { borderBoxSize: [{ inlineSize: width }], contentRect: { width } }])
|
|
@@ -35,7 +35,9 @@ const mockMatchMedia = (query) => {
|
|
|
35
35
|
window.matchMedia = jest.fn(mockMatchMedia)
|
|
36
36
|
|
|
37
37
|
const triggerMQ = (query, matches) => {
|
|
38
|
-
if (mockedQueries[query])
|
|
38
|
+
if (mockedQueries[query]) {
|
|
39
|
+
mockedQueries[query].matches = matches
|
|
40
|
+
}
|
|
39
41
|
mediaListeners[query]?.forEach(fn => fn({ matches }))
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -68,6 +70,46 @@ describe('detectBreakpoint', () => {
|
|
|
68
70
|
detector.destroy()
|
|
69
71
|
})
|
|
70
72
|
|
|
73
|
+
/**
|
|
74
|
+
* Test to ensure coverage for the concurrency guard (Line 75).
|
|
75
|
+
* Validates that if multiple breakpoint changes occur before a RAF
|
|
76
|
+
* frame fires, only the most recent (current) state notifies listeners.
|
|
77
|
+
*/
|
|
78
|
+
it('does not notify listeners if the breakpoint changed again before RAF fired', () => {
|
|
79
|
+
const listener = jest.fn()
|
|
80
|
+
const detector = createBreakpointDetector(cfg)
|
|
81
|
+
detector.subscribe(listener)
|
|
82
|
+
|
|
83
|
+
// 1. Initial flush to clear the "mount" notification
|
|
84
|
+
flushRAF()
|
|
85
|
+
listener.mockClear()
|
|
86
|
+
|
|
87
|
+
// 2. Trigger 'mobile'.
|
|
88
|
+
// This sets lastBreakpoint = 'mobile' and queues RAF #1 (type: 'mobile')
|
|
89
|
+
triggerMQ('(max-width: 768px)', true)
|
|
90
|
+
|
|
91
|
+
// 3. IMMEDIATELY switch to 'desktop' before flushing.
|
|
92
|
+
// IMPORTANT: We must turn mobile OFF so the detector sees 'desktop'.
|
|
93
|
+
triggerMQ('(max-width: 768px)', false)
|
|
94
|
+
triggerMQ('(min-width: 1024px)', true)
|
|
95
|
+
|
|
96
|
+
// At this point:
|
|
97
|
+
// - lastBreakpoint is now 'desktop'
|
|
98
|
+
// - There are 3 callbacks in the RAF queue:
|
|
99
|
+
// - RAF #1 from the mobile trigger (type: 'mobile')
|
|
100
|
+
// - RAF #2 from the mobile=false trigger (type: 'tablet')
|
|
101
|
+
// - RAF #3 from the desktop trigger (type: 'desktop')
|
|
102
|
+
|
|
103
|
+
flushRAF()
|
|
104
|
+
|
|
105
|
+
// RAF #1: ('mobile' === 'desktop') is false -> skip listener
|
|
106
|
+
// RAF #2: ('tablet' === 'desktop') is false -> skip listener
|
|
107
|
+
// RAF #3: ('desktop' === 'desktop') is true -> call listener
|
|
108
|
+
expect(listener).toHaveBeenCalledTimes(1)
|
|
109
|
+
expect(listener).toHaveBeenCalledWith('desktop')
|
|
110
|
+
expect(detector.getBreakpoint()).toBe('desktop')
|
|
111
|
+
})
|
|
112
|
+
|
|
71
113
|
describe('viewport mode', () => {
|
|
72
114
|
it.each([
|
|
73
115
|
['mobile', true, false],
|
|
@@ -76,8 +118,12 @@ describe('detectBreakpoint', () => {
|
|
|
76
118
|
])('detects %s', (name, mobile, desktop) => {
|
|
77
119
|
window.matchMedia.mockImplementation(q => {
|
|
78
120
|
const mq = mockMatchMedia(q)
|
|
79
|
-
if (q === '(max-width: 768px)')
|
|
80
|
-
|
|
121
|
+
if (q === '(max-width: 768px)') {
|
|
122
|
+
mq.matches = mobile
|
|
123
|
+
}
|
|
124
|
+
if (q === '(min-width: 1024px)') {
|
|
125
|
+
mq.matches = desktop
|
|
126
|
+
}
|
|
81
127
|
return mq
|
|
82
128
|
})
|
|
83
129
|
const detector = createBreakpointDetector(cfg)
|
|
@@ -53,14 +53,14 @@ function createInterfaceDetector () {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
window.addEventListener('pointerdown', handlePointer, { passive: true })
|
|
57
|
+
window.addEventListener('keydown', handleKeyDown, { passive: true })
|
|
58
58
|
|
|
59
59
|
// cleanup
|
|
60
60
|
return () => {
|
|
61
61
|
mql.removeEventListener('change', handleMediaChange)
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
window.removeEventListener('pointerdown', handlePointer)
|
|
63
|
+
window.removeEventListener('keydown', handleKeyDown)
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export const isHybridFullscreen = (config) => {
|
|
12
12
|
const { behaviour, hybridWidth, maxMobileWidth } = config
|
|
13
|
-
if (behaviour !== 'hybrid')
|
|
13
|
+
if (behaviour !== 'hybrid') {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
14
16
|
const threshold = hybridWidth ?? maxMobileWidth
|
|
15
17
|
return window.matchMedia(`(max-width: ${threshold}px)`).matches
|
|
16
18
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the safe zone inset — the unobscured region of the map viewport
|
|
3
|
+
* not hidden behind overlay panels, action bars or the footer. Used as padding
|
|
4
|
+
* for map operations like setCenter or fitBounds so the full extent is visible.
|
|
5
|
+
*
|
|
6
|
+
* The algorithm measures the available space around the inset panel and decides
|
|
7
|
+
* whether to push the safe area below or beside it, depending on whether the
|
|
8
|
+
* layout is landscape or portrait oriented.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} refs - React refs for the key layout elements.
|
|
11
|
+
* @param {React.RefObject} refs.mainRef - The main content area.
|
|
12
|
+
* @param {React.RefObject} refs.insetRef - The inset panel (e.g. search results).
|
|
13
|
+
* @param {React.RefObject} refs.rightRef - The right-hand button column.
|
|
14
|
+
* @param {React.RefObject} refs.actionsRef - The bottom action bar.
|
|
15
|
+
* @param {React.RefObject} refs.footerRef - The footer (logo, copyright etc).
|
|
16
|
+
* @returns {{ top: number, right: number, left: number, bottom: number } | undefined}
|
|
17
|
+
* Pixel insets from each edge of the main area, or undefined if any ref is missing.
|
|
18
|
+
*/
|
|
1
19
|
export const getSafeZoneInset = ({
|
|
2
20
|
mainRef,
|
|
3
21
|
insetRef,
|
|
@@ -5,16 +23,14 @@ export const getSafeZoneInset = ({
|
|
|
5
23
|
actionsRef,
|
|
6
24
|
footerRef
|
|
7
25
|
}) => {
|
|
8
|
-
const
|
|
9
|
-
const inset = insetRef.current
|
|
10
|
-
const right = rightRef.current
|
|
11
|
-
const actions = actionsRef.current
|
|
12
|
-
const footer = footerRef.current
|
|
26
|
+
const refs = [mainRef, insetRef, rightRef, actionsRef, footerRef]
|
|
13
27
|
|
|
14
|
-
if (
|
|
15
|
-
return
|
|
28
|
+
if (refs.some(ref => !ref.current)) {
|
|
29
|
+
return undefined
|
|
16
30
|
}
|
|
17
31
|
|
|
32
|
+
const [main, inset, right, actions, footer] = refs.map(ref => ref.current)
|
|
33
|
+
|
|
18
34
|
const root = document.documentElement
|
|
19
35
|
const dividerGap = Number.parseInt(getComputedStyle(root).getPropertyValue('--divider-gap'), 10)
|
|
20
36
|
|
|
@@ -68,4 +68,22 @@ describe('getSafeZoneInset', () => {
|
|
|
68
68
|
expect(result.left).toBe(80)
|
|
69
69
|
expect(result.right).toBe(80)
|
|
70
70
|
})
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Test to ensure coverage for the safety guardrail (Line 29).
|
|
74
|
+
* Validates that the function returns undefined if React refs are
|
|
75
|
+
* not yet attached to DOM elements.
|
|
76
|
+
*/
|
|
77
|
+
it('returns undefined if any ref.current is null (unattached)', () => {
|
|
78
|
+
const unattachedRefs = {
|
|
79
|
+
mainRef: { current: null },
|
|
80
|
+
insetRef: { current: null },
|
|
81
|
+
rightRef: { current: null },
|
|
82
|
+
actionsRef: { current: null },
|
|
83
|
+
footerRef: { current: null }
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const result = getSafeZoneInset(unattachedRefs)
|
|
87
|
+
expect(result).toBeUndefined()
|
|
88
|
+
})
|
|
71
89
|
})
|
|
@@ -11,7 +11,7 @@ const getMapStateFromURL = (id, search) => {
|
|
|
11
11
|
return { center: [lng, lat], zoom }
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const setMapStateInURL = (id, state, currentHref =
|
|
14
|
+
const setMapStateInURL = (id, state, currentHref = window.location.href) => {
|
|
15
15
|
// Use the passed href or the global one
|
|
16
16
|
const url = new URL(currentHref || 'http://localhost')
|
|
17
17
|
const params = [...new URLSearchParams(url.search)].map(([key, value]) => `${key}=${value}`)
|
|
@@ -30,10 +30,10 @@ const setMapStateInURL = (id, state, currentHref = globalThis.location.href) =>
|
|
|
30
30
|
|
|
31
31
|
const hash = url.hash || ''
|
|
32
32
|
const newUrl = `${url.origin}${url.pathname}?${[...filteredParams, ...newParams].join('&')}${hash}`
|
|
33
|
-
|
|
33
|
+
window.history.replaceState(window.history.state, '', newUrl)
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const getInitialMapState = ({ id, center, zoom, bounds }, search =
|
|
36
|
+
const getInitialMapState = ({ id, center, zoom, bounds }, search = window.location.search) => {
|
|
37
37
|
// Pass search string down to the internal function
|
|
38
38
|
const savedState = getMapStateFromURL(id, search)
|
|
39
39
|
if (savedState) {
|
package/src/utils/queryString.js
CHANGED
|
@@ -1,31 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks whether a sibling element should be marked as inert.
|
|
3
|
+
* @param {Element} sibling - The sibling element to evaluate
|
|
4
|
+
* @param {Element} el - The current element being walked up from
|
|
5
|
+
* @param {Element|null} containerEl - The container to preserve (not make inert)
|
|
6
|
+
* @param {Element} boundaryEl - The outermost boundary for the traversal
|
|
7
|
+
* @returns {boolean}
|
|
8
|
+
*/
|
|
9
|
+
const shouldMakeInert = (sibling, el, containerEl, boundaryEl) =>
|
|
10
|
+
sibling !== el &&
|
|
11
|
+
!containerEl?.contains(sibling) &&
|
|
12
|
+
sibling.matches(':not([aria-hidden]):not([data-fm-inert])') &&
|
|
13
|
+
boundaryEl.contains(sibling)
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Toggles inert state on elements outside a container for fullscreen/modal behaviour.
|
|
17
|
+
*
|
|
18
|
+
* When entering fullscreen, walks up from `containerEl` to `boundaryEl`, marking all
|
|
19
|
+
* sibling branches as `aria-hidden` and flagging them with `data-fm-inert` so they
|
|
20
|
+
* can be restored later. When exiting fullscreen, restores all previously inerted elements.
|
|
21
|
+
*
|
|
22
|
+
* @param {Object} options
|
|
23
|
+
* @param {Element|null} options.containerEl - The element to keep interactive
|
|
24
|
+
* @param {boolean} options.isFullscreen - Whether fullscreen mode is active
|
|
25
|
+
* @param {Element} [options.boundaryEl=document.body] - The outermost ancestor to traverse up to
|
|
26
|
+
*/
|
|
1
27
|
export function toggleInertElements ({ containerEl, isFullscreen, boundaryEl = document.body }) {
|
|
28
|
+
// Restore any previously inerted elements
|
|
2
29
|
let inertElements = Array.from(boundaryEl.querySelectorAll('[data-fm-inert]'))
|
|
3
30
|
|
|
4
31
|
if (containerEl) {
|
|
5
|
-
inertElements = inertElements.filter(
|
|
32
|
+
inertElements = inertElements.filter(inertEl => !containerEl.contains(inertEl))
|
|
6
33
|
}
|
|
7
34
|
|
|
8
|
-
inertElements.forEach(
|
|
9
|
-
|
|
10
|
-
|
|
35
|
+
inertElements.forEach(inertEl => {
|
|
36
|
+
inertEl.removeAttribute('aria-hidden')
|
|
37
|
+
delete inertEl.dataset.fmInert
|
|
11
38
|
})
|
|
12
39
|
|
|
13
|
-
if (!isFullscreen)
|
|
40
|
+
if (!isFullscreen) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
14
43
|
|
|
44
|
+
// Entering fullscreen: blur active element and inert all sibling branches
|
|
15
45
|
document.activeElement?.blur()
|
|
16
46
|
|
|
17
47
|
let el = containerEl
|
|
18
48
|
while (el?.parentNode && el !== boundaryEl && el !== document.body) {
|
|
19
49
|
const parent = el.parentNode
|
|
20
50
|
for (const sibling of parent.children) {
|
|
21
|
-
if (
|
|
22
|
-
sibling !== el &&
|
|
23
|
-
(!containerEl || !containerEl.contains(sibling)) &&
|
|
24
|
-
sibling.matches(':not([aria-hidden]):not([data-fm-inert])') &&
|
|
25
|
-
boundaryEl.contains(sibling)
|
|
26
|
-
) {
|
|
51
|
+
if (shouldMakeInert(sibling, el, containerEl, boundaryEl)) {
|
|
27
52
|
sibling.setAttribute('aria-hidden', 'true')
|
|
28
|
-
sibling.
|
|
53
|
+
sibling.dataset.fmInert = ''
|
|
29
54
|
}
|
|
30
55
|
}
|
|
31
56
|
el = parent
|
package/webpack.dev.mjs
CHANGED
|
@@ -66,9 +66,8 @@ export default {
|
|
|
66
66
|
OS_NAMES_URL: JSON.stringify(process.env.OS_NAMES_URL),
|
|
67
67
|
OS_NEAREST_URL: JSON.stringify(process.env.OS_NEAREST_URL),
|
|
68
68
|
// Data services
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
PARCEL_SERVICE_URL: JSON.stringify(process.env.PARCEL_SERVICE_URL)
|
|
69
|
+
FARMING_TILE_SERVICE_URL: JSON.stringify(process.env.FARMING_TILE_SERVICE_URL),
|
|
70
|
+
FARMING_API_URL: JSON.stringify(process.env.FARMING_API_URL)
|
|
72
71
|
}
|
|
73
72
|
})
|
|
74
73
|
],
|
|
@@ -77,7 +76,7 @@ export default {
|
|
|
77
76
|
{
|
|
78
77
|
test: /\.jsx?$/,
|
|
79
78
|
loader: 'babel-loader',
|
|
80
|
-
exclude: /node_modules
|
|
79
|
+
exclude: /node_modules/
|
|
81
80
|
},{
|
|
82
81
|
test: /\.s[ac]ss$/i,
|
|
83
82
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
|
package/webpack.esm.mjs
CHANGED
|
@@ -118,18 +118,18 @@ const ALL_BUILDS = [
|
|
|
118
118
|
|
|
119
119
|
// Providers
|
|
120
120
|
{ entryPath: './providers/maplibre/src/index.js', outDir: 'providers/maplibre/dist/esm' },
|
|
121
|
-
{ entryPath: './providers/open-names/src/index.js', outDir: 'providers/open-names/dist/esm' },
|
|
122
|
-
// { entryPath: './providers/esri/src/index.js', outDir: 'providers/esri/dist/esm' },
|
|
121
|
+
{ entryPath: './providers/beta/open-names/src/index.js', outDir: 'providers/beta/open-names/dist/esm' },
|
|
122
|
+
// { entryPath: './providers/beta/esri/src/index.js', outDir: 'providers/beta/esri/dist/esm' },
|
|
123
123
|
|
|
124
124
|
// Plugins
|
|
125
|
-
{ entryPath: './plugins/scale-bar/src/index.js', outDir: 'plugins/scale-bar/dist/esm' },
|
|
126
|
-
{ entryPath: './plugins/use-location/src/index.js', outDir: 'plugins/use-location/dist/esm' },
|
|
125
|
+
{ entryPath: './plugins/beta/scale-bar/src/index.js', outDir: 'plugins/beta/scale-bar/dist/esm' },
|
|
126
|
+
{ entryPath: './plugins/beta/use-location/src/index.js', outDir: 'plugins/beta/use-location/dist/esm' },
|
|
127
127
|
{ entryPath: './plugins/search/src/index.js', outDir: 'plugins/search/dist/esm' },
|
|
128
128
|
{ entryPath: './plugins/interact/src/index.js', outDir: 'plugins/interact/dist/esm' },
|
|
129
|
-
{ entryPath: './plugins/datasets/src/index.js', outDir: 'plugins/datasets/dist/esm' },
|
|
130
|
-
{ entryPath: './plugins/map-styles/src/index.js', outDir: 'plugins/map-styles/dist/esm' },
|
|
131
|
-
{ entryPath: './plugins/draw-ml/src/index.js', outDir: 'plugins/draw-ml/dist/esm' },
|
|
132
|
-
{ entryPath: './plugins/frame/src/index.js', outDir: 'plugins/frame/dist/esm' }
|
|
129
|
+
{ entryPath: './plugins/beta/datasets/src/index.js', outDir: 'plugins/beta/datasets/dist/esm' },
|
|
130
|
+
{ entryPath: './plugins/beta/map-styles/src/index.js', outDir: 'plugins/beta/map-styles/dist/esm' },
|
|
131
|
+
{ entryPath: './plugins/beta/draw-ml/src/index.js', outDir: 'plugins/beta/draw-ml/dist/esm' },
|
|
132
|
+
{ entryPath: './plugins/beta/frame/src/index.js', outDir: 'plugins/beta/frame/dist/esm' }
|
|
133
133
|
]
|
|
134
134
|
|
|
135
135
|
// === Filter via environment variable ===
|
package/webpack.umd.mjs
CHANGED
|
@@ -133,18 +133,18 @@ const ALL_BUILDS = [
|
|
|
133
133
|
|
|
134
134
|
// Providers
|
|
135
135
|
{ entryPath: './providers/maplibre/src/index.js', libraryPath: 'maplibreProvider', outDir: 'providers/maplibre/dist/umd' },
|
|
136
|
-
{ entryPath: './providers/open-names/src/index.js', libraryPath: 'openNamesProvider', outDir: 'providers/open-names/dist/umd' },
|
|
137
|
-
// { entryPath: './providers/esri/src/index.js', libraryPath: 'esriProvider', outDir: 'providers/esri/dist/umd' },
|
|
136
|
+
{ entryPath: './providers/beta/open-names/src/index.js', libraryPath: 'openNamesProvider', outDir: 'providers/beta/open-names/dist/umd' },
|
|
137
|
+
// { entryPath: './providers/beta/esri/src/index.js', libraryPath: 'esriProvider', outDir: 'providers/beta/esri/dist/umd' },
|
|
138
138
|
|
|
139
139
|
// Plugins
|
|
140
|
-
{ entryPath: './plugins/scale-bar/src/index.js', libraryPath: 'scaleBarPlugin', outDir: 'plugins/scale-bar/dist/umd' },
|
|
141
|
-
{ entryPath: './plugins/use-location/src/index.js', libraryPath: 'drawPolygonMLPlugin', outDir: 'plugins/use-location/dist/umd' },
|
|
140
|
+
{ entryPath: './plugins/beta/scale-bar/src/index.js', libraryPath: 'scaleBarPlugin', outDir: 'plugins/beta/scale-bar/dist/umd' },
|
|
141
|
+
{ entryPath: './plugins/beta/use-location/src/index.js', libraryPath: 'drawPolygonMLPlugin', outDir: 'plugins/beta/use-location/dist/umd' },
|
|
142
142
|
{ entryPath: './plugins/search/src/index.js', libraryPath: 'searchPlugin', outDir: 'plugins/search/dist/umd' },
|
|
143
143
|
{ entryPath: './plugins/interact/src/index.js', libraryPath: 'interactPlugin', outDir: 'plugins/interact/dist/umd' },
|
|
144
|
-
{ entryPath: './plugins/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/datasets/dist/umd' },
|
|
145
|
-
{ entryPath: './plugins/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/map-styles/dist/umd' },
|
|
146
|
-
{ entryPath: './plugins/draw-ml/src/index.js', libraryPath: 'drawMLPlugin', outDir: 'plugins/draw-ml/dist/umd' },
|
|
147
|
-
{ entryPath: './plugins/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/frame/dist/umd' }
|
|
144
|
+
{ entryPath: './plugins/beta/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/beta/datasets/dist/umd' },
|
|
145
|
+
{ entryPath: './plugins/beta/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/beta/map-styles/dist/umd' },
|
|
146
|
+
{ entryPath: './plugins/beta/draw-ml/src/index.js', libraryPath: 'drawMLPlugin', outDir: 'plugins/beta/draw-ml/dist/umd' },
|
|
147
|
+
{ entryPath: './plugins/beta/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/beta/frame/dist/umd' }
|
|
148
148
|
]
|
|
149
149
|
|
|
150
150
|
// === Filter via environment variable ===
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const __webpack_id__="im-datasets-plugin";export const __webpack_ids__=["im-datasets-plugin"];export const __webpack_modules__={"./plugins/datasets/src/manifest.js":(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t){return function(t){if(Array.isArray(t))return o(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function l(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach(function(e){s(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function s(t,e,r){return(e=u(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function u(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}r.r(e),r.d(e,{manifest:()=>M});var c={SET_DATASETS:function(t,e){var r=e.datasets,n=e.datasetDefaults;return l(l({},t),{},{datasets:r.map(function(t){return l(l({},n),t)})})},ADD_DATASET:function(t,e){var r=e.dataset,n=e.datasetDefaults;return l(l({},t),{},{datasets:[].concat(i(t.datasets||[]),[l(l({},n),r)])})},REMOVE_DATASET:function(t,e){var r,n=e.id;return l(l({},t),{},{datasets:(null===(r=t.datasets)||void 0===r?void 0:r.filter(function(t){return t.id!==n}))||[]})},SET_DATASET_VISIBILITY:function(t,e){var r,n=e.id,i=e.visibility;return l(l({},t),{},{datasets:null===(r=t.datasets)||void 0===r?void 0:r.map(function(t){return t.id===n?l(l({},t),{},{visibility:i}):t})})},HIDE_FEATURES:function(t,e){var r=e.layerId,n=e.idProperty,o=e.featureIds,a=t.hiddenFeatures[r],u=(null==a?void 0:a.ids)||[],c=i(new Set([].concat(i(u),i(o))));return l(l({},t),{},{hiddenFeatures:l(l({},t.hiddenFeatures),{},s({},r,{idProperty:n,ids:c}))})},SHOW_FEATURES:function(t,e){var r=e.layerId,n=e.featureIds,i=t.hiddenFeatures[r];if(!i)return t;var o=i.ids.filter(function(t){return!n.includes(t)});if(0===o.length){var a=t.hiddenFeatures,c=(a[r],function(t,e){if(null==t)return{};var r,n,i=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(n=0;n<o.length;n++)r=o[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(i[r]=t[r])}return i}(a,[r].map(u)));return l(l({},t),{},{hiddenFeatures:c})}return l(l({},t),{},{hiddenFeatures:l(l({},t.hiddenFeatures),{},s({},r,l(l({},i),{},{ids:o})))})}},d=r("react"),f={stroke:"#d4351c",strokeWidth:2,fill:"transparent",symbolDescription:"red outline",minZoom:6,maxZoom:24,showInKey:!1,showInLayers:!1,visibility:"visible"};function y(t){return y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y(t)}var p=function(t,e){if(!t)return null;if("string"==typeof t)return t.trim();if("object"===y(t)){if(e&&t[e])return t[e];var r=Object.values(t)[0];return null!=r?r:null}return null};function v(t){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(t)}function m(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?m(Object(r),!0).forEach(function(e){h(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function h(t,e,r){return(e=function(t){var e=function(t){if("object"!=v(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==v(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var S=function(t){var e,r=0,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return g(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?g(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(t);try{for(n.s();!(e=n.n()).done;)r=(r<<5)-r+e.value.codePointAt(0),r&=r}catch(t){n.e(t)}finally{n.f()}return Math.abs(r).toString(36)},j=function(t){if(t.tiles){var e=Array.isArray(t.tiles)?t.tiles.join(","):t.tiles;return"tiles-".concat(S(e))}return t.geojson?"string"==typeof t.geojson?"geojson-".concat(S(t.geojson)):"geojson-".concat(t.id):"source-".concat(t.id)},k=function(t,e,r){var n=j(r);t.getSource(n)||(r.tiles?t.addSource(n,{type:"vector",tiles:r.tiles,minzoom:r.minZoom||0,maxzoom:r.maxZoom||22}):r.geojson&&t.addSource(n,{type:"geojson",data:r.geojson}));var i=!!r.fill,o=!!r.stroke,a=i?r.id:null,l=o?i?"".concat(r.id,"-stroke"):r.id:null,s="hidden"===r.visibility?"none":"visible";if(i&&!t.getLayer(a)){var u,c=p(r.fill,e);t.addLayer(b({id:a,type:"fill",source:n,"source-layer":null!=r&&null!==(u=r.tiles)&&void 0!==u&&u.length?r.sourceLayer:void 0,layout:{visibility:s},paint:{"fill-color":c,"fill-opacity":r.opacity||1}},r.filter?{filter:r.filter}:{}))}if(o&&!t.getLayer(l)){var d,f=p(r.stroke,e);t.addLayer(b({id:l,type:"line",source:n,"source-layer":null!=r&&null!==(d=r.tiles)&&void 0!==d&&d.length?r.sourceLayer:void 0,layout:{visibility:s},paint:b({"line-color":f,"line-width":r.strokeWidth||1,"line-opacity":r.opacity||1},r.strokeDashArray?{"line-dasharray":r.strokeDashArray}:{})},r.filter?{filter:r.filter}:{}))}},w=function(t,e,r,n,i){if(t.getLayer(e)){var o=function(t,e,r){if(!r||0===r.length)return t;var n=["!",["in",["to-string",["get",e]],["literal",r.map(function(t){return String(t)})]]];return t?["all",t,n]:n}(r,n,i);t.setFilter(e,o)}};function O(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var P=function(t){var e=t.pluginConfig,r=t.pluginStateRef,n=t.mapStyleId,i=t.mapProvider,o=t.events,a=t.eventBus,l=i.map,s=e.datasets,u=function(){return r.current.datasets||s};s.forEach(function(t){k(l,n,t)}),l.once("idle",function(){a.emit("datasets:ready")});var c=function(t){var e=t.map,r=t.events,n=t.getDatasets,i=t.getHiddenFeatures,o=function(t){e.once("idle",function(){var r=t.id,o=n(),a=i();o.forEach(function(t){k(e,r,t)}),Object.entries(a).forEach(function(t){var r=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,l=[],s=!0,u=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=o.call(r)).done)&&(l.push(n.value),l.length!==e);s=!0);}catch(t){u=!0,i=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return l}}(t,e)||function(t,e){if(t){if("string"==typeof t)return O(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?O(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2),n=r[0],i=r[1],a=i.idProperty,l=i.ids,s=o.find(function(t){return t.id===n});if(s){var u=s.filter||null,c=!!s.fill,d=!!s.stroke,f=c?n:null,y=d?c?"".concat(n,"-stroke"):n:null;f&&w(e,f,u,a,l),y&&w(e,y,u,a,l)}})})};return t.eventBus.on(r.MAP_SET_STYLE,o),o}({map:l,events:o,eventBus:a,getDatasets:u,getHiddenFeatures:function(){return r.current.hiddenFeatures||{}}});return{remove:function(){a.off(o.MAP_SET_STYLE,c);var t=u(),e=new Set;t.forEach(function(t){var r=j(t),n=function(t,e){var r=t.getStyle();return null!=r&&r.layers?r.layers.filter(function(t){return t.source===e}).map(function(t){return t.id}):[]}(l,r);n.forEach(function(t){return l.removeLayer(t)}),!e.has(r)&&l.getSource(r)&&(l.removeSource(r),e.add(r))})}}},A=function(t,e){var r=t.mapProvider,n=t.pluginState,i=r.map;i.getLayer(e)&&i.setLayoutProperty(e,"visibility","visible"),i.getLayer("".concat(e,"-stroke"))&&i.setLayoutProperty("".concat(e,"-stroke"),"visibility","visible"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"visible"}})},I=function(t,e){var r=t.mapProvider,n=t.pluginState,i=r.map;i.getLayer(e)&&i.setLayoutProperty(e,"visibility","none"),i.getLayer("".concat(e,"-stroke"))&&i.setLayoutProperty("".concat(e,"-stroke"),"visibility","none"),n.dispatch({type:"SET_DATASET_VISIBILITY",payload:{id:e,visibility:"hidden"}})},E=r("react/jsx-runtime");function _(t){return _="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_(t)}function x(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function L(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?x(Object(r),!0).forEach(function(e){D(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function D(t,e,r){return(e=function(t){var e=function(t){if("object"!=_(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=_(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==_(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function T(t){return function(t){if(Array.isArray(t))return F(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return F(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?F(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}var M={InitComponent:function(t){var e,r=t.pluginConfig,n=t.pluginState,i=t.appState,o=t.mapState,a=t.mapProvider,l=t.services,s=n.dispatch,u=l.events,c=l.eventBus,y=!(null===(e=a.map)||void 0===e||!e.getStyle()),p=(0,d.useRef)(n);p.current=n;var v=(0,d.useRef)(null);return(0,d.useEffect)(function(){var t,e,l,d,m=null===(t=null===(e=r.includeModes)||void 0===e?void 0:e.includes(i.mode))||void 0===t||t,b=null!==(l=null===(d=r.excludeModes)||void 0===d?void 0:d.includes(i.mode))&&void 0!==l&&l;y&&m&&!b&&(v.current||(n.datasets||s({type:"SET_DATASETS",payload:{datasets:r.datasets,datasetDefaults:f}}),v.current=P({mapStyleId:o.mapStyle.id,pluginConfig:r,pluginStateRef:p,mapProvider:a,events:u,eventBus:c})))},[y,i.mode]),(0,d.useEffect)(function(){return function(){v.current&&(v.current.remove(),v.current=null)}},[]),null},reducer:{initialState:{datasets:null,hiddenFeatures:{}},actions:c},panels:[{id:"datasetsLayers",label:"Layers",mobile:{slot:"bottom",modal:!0,dismissable:!0},tablet:{slot:"inset",dismissable:!0,exclusive:!0,width:"300px"},desktop:{slot:"inset",modal:!1,dismissable:!0,exclusive:!0,width:"320px"},render:function(t){var e=t.pluginState,r=t.mapProvider,n=function(t){var n=t.target,i=n.value;n.checked?A({mapProvider:r,pluginState:e},i):I({mapProvider:r,pluginState:e},i)};return(0,E.jsx)("div",{className:"im-c-datasets-layers",children:(0,E.jsx)("div",{className:"govuk-form-group",children:(0,E.jsxs)("fieldset",{className:"govuk-fieldset",children:[(0,E.jsx)("legend",{className:"govuk-visually-hidden",children:"Layers"}),(0,E.jsx)("div",{className:"govuk-checkboxes govuk-checkboxes--small","data-module":"govuk-checkboxes",children:(e.datasets||[]).filter(function(t){return t.showInLayers}).map(function(t){return(0,E.jsx)("div",{className:"im-c-datasets-layers__item".concat("hidden"!==t.visibility?" im-c-datasets-layers__item--checked":""),children:(0,E.jsxs)("div",{className:"govuk-checkboxes__item",children:[(0,E.jsx)("input",{className:"govuk-checkboxes__input",id:t.id,name:"layers",type:"checkbox",value:t.id,checked:"hidden"!==t.visibility,onChange:n}),(0,E.jsx)("label",{className:"im-c-datasets-layers__item-label govuk-label govuk-checkboxes__label",htmlFor:t.id,children:t.label})]})},t.id)})})]})})})}},{id:"datasetsKey",label:"Key",mobile:{slot:"bottom",modal:!0},tablet:{slot:"inset",width:"300px"},desktop:{slot:"inset",width:"320px"},render:function(t){var e=t.mapState,r=t.pluginState,n=e.mapStyle,i=function(t){return(0,E.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:"line"===t.keySymbolShape?(0,E.jsx)("line",{x1:t.strokeWidth/2,y1:"10",x2:20-t.strokeWidth/2,y2:"10",stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinecap:"round"}):(0,E.jsx)("rect",{x:t.strokeWidth/2,y:t.strokeWidth/2,width:20-t.strokeWidth,height:20-t.strokeWidth,rx:t.strokeWidth,ry:t.strokeWidth,fill:p(t.fill,n.id),stroke:p(t.stroke,n.id),strokeWidth:t.strokeWidth,strokeLinejoin:"round"})})};return(0,E.jsx)("div",{className:"im-c-datasets-key",children:(r.datasets||[]).filter(function(t){return t.showInKey&&"hidden"!==t.visibility}).map(function(t){return(0,E.jsx)("div",{className:"im-c-datasets-key__item",children:(0,E.jsxs)("div",{className:"im-c-datasets-key__item-label",children:[i(t),t.label,t.symbolDescription&&(0,E.jsxs)("span",{className:"govuk-visually-hidden",children:["(",p(t.symbolDescription,n.id),")"]})]})},t.id)})})}}],buttons:[{id:"datasetsLayers",label:"Layers",panelId:"datasetsLayers",iconId:"layers",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInLayers})},mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}},{id:"datasetsKey",label:"Key",panelId:"datasetsKey",iconId:"key",excludeWhen:function(t){return!t.pluginConfig.datasets.find(function(t){return t.showInKey})},mobile:{slot:"top-left",showLabel:!0},tablet:{slot:"top-left",showLabel:!0},desktop:{slot:"top-left",showLabel:!0}}],icons:[{id:"layers",svgContent:'<path d="M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74z"></path><path d="m20 14.285 1.5.845a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74l1.5-.845"></path>'},{id:"key",svgContent:'<path d="M3 5h.01"/><path d="M3 12h.01"/><path d="M3 19h.01"/><path d="M8 5h13"/><path d="M8 12h13"/><path d="M8 19h13"/>'}],api:{showDataset:A,hideDataset:I,addDataset:function(t,e){var r=t.mapProvider,n=t.mapState,i=t.pluginState,o=r.map;k(o,n.mapStyle.id,L(L({},f),e)),i.dispatch({type:"ADD_DATASET",payload:{dataset:e,datasetDefaults:f}})},removeDataset:function(t,e){var r,n,i=t.mapProvider,o=t.pluginState,a=i.map,l=null===(r=o.datasets)||void 0===r?void 0:r.find(function(t){return t.id===e});if(l){var s=function(t){var e=!!t.fill,r=!!t.stroke,n=e?t.id:null,i=null;return r&&(i=e?"".concat(t.id,"-stroke"):t.id),{fillLayerId:n,strokeLayerId:i}}(l),u=s.fillLayerId,c=s.strokeLayerId,d=j(l);[c,u].forEach(function(t){t&&a.getLayer(t)&&a.removeLayer(t)}),!(null===(n=o.datasets)||void 0===n?void 0:n.some(function(t){return t.id!==e&&j(t)===d}))&&a.getSource(d)&&a.removeSource(d),o.dispatch({type:"REMOVE_DATASET",payload:{id:e}})}},showFeatures:function(t,e){var r,n=t.mapProvider,i=t.pluginState,o=e.featureIds,a=e.idProperty,l=e.datasetId,s=n.map,u=i.hiddenFeatures[l];if(u){var c=null===(r=i.datasets)||void 0===r?void 0:r.find(function(t){return t.id===l});if(c){var d=c.filter||null,f=!!c.fill,y=!!c.stroke,p=f?l:null,v=null;y&&(v=f?"".concat(l,"-stroke"):l);var m=u.ids.filter(function(t){return!o.includes(t)});i.dispatch({type:"SHOW_FEATURES",payload:{layerId:l,featureIds:o}}),p&&w(s,p,d,a,m),v&&w(s,v,d,a,m)}}},hideFeatures:function(t,e){var r,n=t.mapProvider,i=t.pluginState,o=e.featureIds,a=e.idProperty,l=e.datasetId,s=n.map,u=null===(r=i.datasets)||void 0===r?void 0:r.find(function(t){return t.id===l});if(u){var c=u.filter||null,d=!!u.fill,f=!!u.stroke,y=d?l:null,p=null;f&&(p=d?"".concat(l,"-stroke"):l);var v=i.hiddenFeatures[l],m=v?T(new Set([].concat(T(v.ids),T(o)))):o;i.dispatch({type:"HIDE_FEATURES",payload:{layerId:l,idProperty:a,featureIds:o}}),y&&w(s,y,c,a,m),p&&w(s,p,c,a,m)}}}}}};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import*as t from"react";import*as e from"react/jsx-runtime";var r,n,o={react:(e,r,n)=>{var o,i;e.exports=(o={useEffect:()=>t.useEffect,useRef:()=>t.useRef},i={},n.d(i,o),i)},"react/jsx-runtime":(t,r,n)=>{var o,i;t.exports=(o={jsx:()=>e.jsx,jsxs:()=>e.jsxs},i={},n.d(i,o),i)}},i={};function u(t){var e=i[t];if(void 0!==e)return e.exports;var r=i[t]={exports:{}};return o[t](r,r.exports,u),r.exports}u.m=o,u.d=(t,e)=>{for(var r in e)u.o(e,r)&&!u.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},u.f={},u.e=t=>Promise.all(Object.keys(u.f).reduce((e,r)=>(u.f[r](t,e),e),[])),u.u=t=>"../esm/"+t+".js",u.miniCssF=t=>{},u.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),u.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;if("string"==typeof import.meta.url&&(t=import.meta.url),!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u.p=t+"../css/"})(),r={index:0},n=t=>{var e,n,{__webpack_ids__:o,__webpack_modules__:i,__webpack_runtime__:c}=t,a=0;for(e in i)u.o(i,e)&&(u.m[e]=i[e]);for(c&&c(u);a<o.length;a++)n=o[a],u.o(r,n)&&r[n]&&r[n][0](),r[o[a]]=0},u.f.j=(t,e)=>{var o=u.o(r,t)?r[t]:void 0;if(0!==o)if(o)e.push(o[1]);else{var i=import("../css/"+u.u(t)).then(n,e=>{throw 0!==r[t]&&(r[t]=void 0),e});i=Promise.race([i,new Promise(e=>o=r[t]=[e])]),e.push(o[1]=i)}};var c={};function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function f(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var a=n&&n.prototype instanceof c?n:c,f=Object.create(a.prototype);return s(f,"_invoke",function(r,n,o){var i,c,a,f=0,s=o||[],p=!1,l={p:0,n:0,v:t,a:y,f:y.bind(t,4),d:function(e,r){return i=e,c=0,a=t,l.n=r,u}};function y(r,n){for(c=r,a=n,e=0;!p&&f&&!o&&e<s.length;e++){var o,i=s[e],y=l.p,b=i[2];r>3?(o=b===n)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=y&&((o=r<2&&y<i[1])?(c=0,l.v=n,l.n=i[1]):y<b&&(o=r<3||i[0]>n||n>b)&&(i[4]=r,i[5]=n,l.n=b,c=0))}if(o||r>1)return u;throw p=!0,n}return function(o,s,b){if(f>1)throw TypeError("Generator is already running");for(p&&1===s&&y(s,b),c=s,a=b;(e=c<2?t:a)||!p;){i||(c?c<3?(c>1&&(l.n=-1),y(c,a)):l.n=a:l.v=a);try{if(f=2,i){if(c||(o="next"),e=i[o]){if(!(e=e.call(i,a)))throw TypeError("iterator result is not an object");if(!e.done)return e;a=e.value,c<2&&(c=0)}else 1===c&&(e=i.return)&&e.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((e=(p=l.n<0)?a:r.call(n,l))!==u)break}catch(e){i=t,c=1,a=e}finally{f=1}}return{value:e,done:p}}}(r,o,i),!0),f}var u={};function c(){}function a(){}function p(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(s(e={},n,function(){return this}),e),y=p.prototype=c.prototype=Object.create(l);function b(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,s(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t}return a.prototype=p,s(y,"constructor",p),s(p,"constructor",a),a.displayName="GeneratorFunction",s(p,o,"GeneratorFunction"),s(y),s(y,o,"Generator"),s(y,n,function(){return this}),s(y,"toString",function(){return"[object Generator]"}),(f=function(){return{w:i,m:b}})()}function s(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}s=function(t,e,r,n){if(e)o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r;else{function i(e,r){s(t,e,function(t){return this._invoke(e,r,t)})}i("next",0),i("throw",1),i("return",2)}},s(t,e,r,n)}function p(t,e,r,n,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void r(t)}c.done?e(a):Promise.resolve(a).then(n,o)}function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function y(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach(function(e){b(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function b(t,e,r){return(e=function(t){var e=function(t){if("object"!=a(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==a(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function v(){var t,e,r=y(y({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"datasets",load:(t=f().m(function t(){var e;return f().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,u.e("im-datasets-plugin").then(u.bind(u,"./plugins/datasets/src/manifest.js"));case 1:return e=t.v.manifest,t.a(2,e)}},t)}),e=function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function u(t){p(i,n,o,u,c,"next",t)}function c(t){p(i,n,o,u,c,"throw",t)}u(void 0)})},function(){return e.apply(this,arguments)})});return r}u.d(c,{A:()=>v});const m=c.A;export{m as default};
|