@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
|
@@ -33,8 +33,8 @@ if (needsThrowIfAborted) {
|
|
|
33
33
|
|
|
34
34
|
// Inject polyfills into web workers — workers have their own global scope so
|
|
35
35
|
// main thread polyfills don't apply. Two cases:
|
|
36
|
-
// 1. Blob URL workers (MapLibre
|
|
37
|
-
// 2. String URL workers
|
|
36
|
+
// 1. Blob URL workers (MapLibre, when its worker is cross-origin): intercept URL.createObjectURL
|
|
37
|
+
// 2. String URL classic workers: intercept Worker constructor
|
|
38
38
|
const needsWorkerPolyfills = (needsThrowIfAborted || needsHasOwn) && typeof URL !== 'undefined' && URL.createObjectURL
|
|
39
39
|
|
|
40
40
|
if (needsWorkerPolyfills) {
|
|
@@ -59,7 +59,8 @@ if (needsWorkerPolyfills) {
|
|
|
59
59
|
const NativeWorker = Worker
|
|
60
60
|
// eslint-disable-next-line no-global-assign
|
|
61
61
|
Worker = function (url, options) {
|
|
62
|
-
|
|
62
|
+
// Module workers can't call importScripts, so they are left unwrapped
|
|
63
|
+
if (typeof url === 'string' && !url.startsWith('blob:') && options?.type !== 'module') {
|
|
63
64
|
const blob = new Blob([`${workerPolyfillCode}importScripts(${JSON.stringify(url)})`], { type: JS_MIME })
|
|
64
65
|
url = _createObjectURL(blob)
|
|
65
66
|
}
|
|
@@ -147,6 +147,18 @@ describe('Worker constructor (string workerUrl)', () => {
|
|
|
147
147
|
expect(MockWorker).toHaveBeenCalledWith('blob:http://localhost/existing', undefined)
|
|
148
148
|
})
|
|
149
149
|
|
|
150
|
+
test('passes module worker URLs through without wrapping', () => {
|
|
151
|
+
const MockWorker = setupWorkerMock()
|
|
152
|
+
const mockCreate = jest.fn(() => 'blob:new')
|
|
153
|
+
URL.createObjectURL = mockCreate
|
|
154
|
+
load()
|
|
155
|
+
|
|
156
|
+
// eslint-disable-next-line no-new
|
|
157
|
+
new Worker('/maplibre-gl-worker.mjs', { type: 'module' }) // NOSONAR
|
|
158
|
+
expect(mockCreate).not.toHaveBeenCalled()
|
|
159
|
+
expect(MockWorker).toHaveBeenCalledWith('/maplibre-gl-worker.mjs', { type: 'module' })
|
|
160
|
+
})
|
|
161
|
+
|
|
150
162
|
test('preserves the Worker prototype', () => {
|
|
151
163
|
const MockWorker = setupWorkerMock()
|
|
152
164
|
const mockProto = { foo: 'bar' }
|
package/src/config/events.js
CHANGED
|
@@ -178,11 +178,13 @@ export const EVENTS = {
|
|
|
178
178
|
*/
|
|
179
179
|
MAP_STYLE_CHANGE: 'map:stylechange',
|
|
180
180
|
|
|
181
|
-
/** Emitted when the map has
|
|
181
|
+
/** Emitted once, when the initial base map has loaded. */
|
|
182
182
|
MAP_LOADED: 'map:loaded',
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
|
-
* Emitted when the map
|
|
185
|
+
* Emitted when the map instance has been created and initial app state (style and size) is settled.
|
|
186
|
+
* The base map may still be loading; wait for `MAP_LOADED` before adding sources or layers
|
|
187
|
+
* to the underlying map.
|
|
186
188
|
*
|
|
187
189
|
* Payload:
|
|
188
190
|
* - `map` — the underlying map instance
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
// error/warning text, buttons, .govuk-link--inverse/--text-colour/--muted) are left untouched so
|
|
8
8
|
// their built-in contrast pairing isn't broken.
|
|
9
9
|
// stylelint-disable declaration-no-important -- resetting a third-party stylesheet's own colours, see comment above
|
|
10
|
+
// The NOSONAR markers silence Sonar's equivalent rule (css:S9423) for the same reason.
|
|
10
11
|
@mixin govuk-content-fallback-colors {
|
|
11
12
|
:is(
|
|
12
13
|
.govuk-body, .govuk-body-l, .govuk-body-m, .govuk-body-s, .govuk-body-xs,
|
|
@@ -14,16 +15,16 @@
|
|
|
14
15
|
.govuk-list, .govuk-label, .govuk-fieldset__legend,
|
|
15
16
|
.govuk-table, .govuk-table__cell, .govuk-table__header
|
|
16
17
|
) {
|
|
17
|
-
color: var(--foreground-color) !important;
|
|
18
|
+
color: var(--foreground-color) !important; // NOSONAR
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// GOV.UK Frontend renders these as its muted grey, matching our --secondary-text-color.
|
|
21
22
|
:is(.govuk-hint, .govuk-caption-xl, .govuk-caption-l, .govuk-caption-m, .govuk-caption-s) {
|
|
22
|
-
color: var(--secondary-text-color) !important;
|
|
23
|
+
color: var(--secondary-text-color) !important; // NOSONAR
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
.govuk-link:is(:link, :visited) {
|
|
26
|
-
color: var(--content-link-color) !important;
|
|
27
|
+
color: var(--content-link-color) !important; // NOSONAR
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
// stylelint-enable declaration-no-important
|
package/src/types.js
CHANGED
|
@@ -383,11 +383,9 @@
|
|
|
383
383
|
* @typedef {Object} MaplibreProviderConfig
|
|
384
384
|
*
|
|
385
385
|
* @property {string} [workerUrl]
|
|
386
|
-
* URL
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* When set, MapLibre loads the worker from this URL instead of generating an
|
|
390
|
-
* inline blob, so your CSP only needs `worker-src 'self'`.
|
|
386
|
+
* URL of the MapLibre worker file. Set automatically with webpack, Vite and the UMD
|
|
387
|
+
* build; with other bundlers (such as esbuild), serve `maplibre-gl/dist/maplibre-gl-worker.mjs`
|
|
388
|
+
* and set its URL here.
|
|
391
389
|
*/
|
|
392
390
|
|
|
393
391
|
/**
|
package/webpack.dev.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import webpack from 'webpack'
|
|
2
|
-
import path, { dirname } from 'path'
|
|
3
|
-
import { fileURLToPath } from 'url'
|
|
2
|
+
import path, { dirname } from 'node:path'
|
|
3
|
+
import { fileURLToPath } from 'node:url'
|
|
4
4
|
import { setupMiddlewares } from './demo/server/main.js'
|
|
5
5
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
|
|
6
6
|
import CopyPlugin from 'copy-webpack-plugin'
|
|
7
7
|
import dotenv from 'dotenv'
|
|
8
8
|
|
|
9
|
-
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url)) // NOSONAR - Standard Node.js convention in bundler configs
|
|
10
10
|
dotenv.config({ path: path.join(__dirname, './.env'), quiet: true })
|
|
11
11
|
|
|
12
12
|
export default {
|
|
@@ -106,6 +106,8 @@ export default {
|
|
|
106
106
|
}
|
|
107
107
|
})
|
|
108
108
|
],
|
|
109
|
+
// maplibre-gl builds a URL from an expression when its worker is cross-origin; harmless
|
|
110
|
+
ignoreWarnings: [{ module: /maplibre-gl/, message: /Critical dependency/ }],
|
|
109
111
|
module: {
|
|
110
112
|
rules: [
|
|
111
113
|
{
|
|
@@ -118,6 +120,12 @@ export default {
|
|
|
118
120
|
}, {
|
|
119
121
|
test: /\.css$/i,
|
|
120
122
|
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
|
123
|
+
}, {
|
|
124
|
+
// Keeps the esm demo's chunks separate from the other demos' chunks
|
|
125
|
+
test: /[\\/]dist[\\/]esm[\\/].+\.js$/,
|
|
126
|
+
exclude: /node_modules/,
|
|
127
|
+
enforce: 'pre',
|
|
128
|
+
loader: path.join(__dirname, 'demo/webpack/prefixEsmChunkNames.cjs')
|
|
121
129
|
}
|
|
122
130
|
]
|
|
123
131
|
},
|
package/webpack.prod.mjs
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { merge } from 'webpack-merge'
|
|
2
2
|
import common from './webpack.dev.mjs'
|
|
3
3
|
import CompressionPlugin from 'compression-webpack-plugin'
|
|
4
|
-
import zlib from 'zlib'
|
|
5
|
-
import path, { dirname } from 'path'
|
|
6
|
-
import { fileURLToPath } from 'url'
|
|
4
|
+
import zlib from 'node:zlib'
|
|
5
|
+
import path, { dirname } from 'node:path'
|
|
6
|
+
import { fileURLToPath } from 'node:url'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// Demos that use the Esri provider, left out of the production build
|
|
9
|
+
const esriEntries = new Set(['esri-datasets', 'planning'])
|
|
10
|
+
|
|
11
|
+
const entry = Object.fromEntries(
|
|
12
|
+
Object.entries(common.entry).filter(([name]) => !esriEntries.has(name))
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
export default merge({ ...common, entry }, {
|
|
9
16
|
mode: 'production',
|
|
10
17
|
target: ['web', 'es5'],
|
|
11
18
|
devServer: {
|
package/webpack.umd.mjs
CHANGED
|
@@ -59,6 +59,10 @@ const createUMDConfig = (entryName, entryPath, libraryPath, outDir, isCore = fal
|
|
|
59
59
|
return {
|
|
60
60
|
mode: 'production',
|
|
61
61
|
|
|
62
|
+
// ES5 so the code that runs before the device check (webpack's runtime and the
|
|
63
|
+
// entry chunks) parses in old browsers, which then show the not-supported message
|
|
64
|
+
target: ['web', 'es5'],
|
|
65
|
+
|
|
62
66
|
entry: { [entryName]: entryPath },
|
|
63
67
|
|
|
64
68
|
parallelism: 100,
|
|
@@ -80,7 +84,8 @@ const createUMDConfig = (entryName, entryPath, libraryPath, outDir, isCore = fal
|
|
|
80
84
|
export: 'default',
|
|
81
85
|
umdNamedDefine: true
|
|
82
86
|
},
|
|
83
|
-
|
|
87
|
+
// Not plain `this`: with the ES5 target the bundle runs in a strict-mode function, where it's undefined
|
|
88
|
+
globalObject: "typeof self !== 'undefined' ? self : this",
|
|
84
89
|
chunkLoadingGlobal: 'webpackChunkdefra_DefraMap',
|
|
85
90
|
auxiliaryComment: {
|
|
86
91
|
root: 'Root Export',
|
|
@@ -109,17 +114,30 @@ const createUMDConfig = (entryName, entryPath, libraryPath, outDir, isCore = fal
|
|
|
109
114
|
|
|
110
115
|
resolve: {
|
|
111
116
|
extensions: ['.tsx', '.ts', '.jsx', '.js'],
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
// Plugins use the core's Preact through the externals above. The core bundles Preact
|
|
118
|
+
// in place of React, as the ESM and dev builds do; React's module code also uses
|
|
119
|
+
// Symbol, which would stop the entry point loading in old browsers.
|
|
120
|
+
alias: externalPreact
|
|
121
|
+
? {
|
|
122
|
+
preact: false,
|
|
123
|
+
'preact/compat': false,
|
|
124
|
+
'preact/hooks': false,
|
|
125
|
+
'preact/jsx-runtime': false
|
|
126
|
+
}
|
|
127
|
+
: {
|
|
128
|
+
react: path.resolve(__dirname, 'node_modules/preact/compat'),
|
|
129
|
+
'react-dom/client': path.resolve(__dirname, 'node_modules/preact/compat/client'),
|
|
130
|
+
'react-dom': path.resolve(__dirname, 'node_modules/preact/compat'),
|
|
131
|
+
'react/jsx-runtime': path.resolve(__dirname, 'node_modules/preact/jsx-runtime')
|
|
132
|
+
}
|
|
118
133
|
},
|
|
119
134
|
|
|
120
135
|
module: {
|
|
121
136
|
rules: [
|
|
122
137
|
{ test: /\.jsx?$/, loader: 'babel-loader', exclude: /node_modules/ },
|
|
138
|
+
// Emitted with a .js extension because some servers don't send a JavaScript
|
|
139
|
+
// content type for .mjs, which module workers require
|
|
140
|
+
{ test: /maplibre-gl-worker\.mjs$/, type: 'asset/resource', generator: { filename: 'im-maplibre-worker.js' } },
|
|
123
141
|
{ test: /\.css$/i, use: [MiniCssExtractPlugin.loader, 'css-loader'] },
|
|
124
142
|
{ test: /\.s[ac]ss$/i, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'] }
|
|
125
143
|
]
|
|
@@ -127,6 +145,9 @@ const createUMDConfig = (entryName, entryPath, libraryPath, outDir, isCore = fal
|
|
|
127
145
|
|
|
128
146
|
plugins,
|
|
129
147
|
|
|
148
|
+
// maplibre-gl builds a URL from an expression when its worker is cross-origin; harmless
|
|
149
|
+
ignoreWarnings: [{ module: /maplibre-gl/, message: /Critical dependency/ }],
|
|
150
|
+
|
|
130
151
|
optimization: {
|
|
131
152
|
splitChunks: { chunks: () => false },
|
|
132
153
|
removeEmptyChunks: true,
|
|
@@ -145,21 +166,20 @@ const ALL_BUILDS = [
|
|
|
145
166
|
|
|
146
167
|
// Providers
|
|
147
168
|
{ entryPath: './providers/maplibre/src/index.js', libraryPath: 'maplibreProvider', outDir: 'providers/maplibre/dist/umd' },
|
|
148
|
-
{ entryPath: './providers/
|
|
149
|
-
{ entryPath: './providers/
|
|
169
|
+
{ entryPath: './providers/open-names/src/index.js', libraryPath: 'openNamesProvider', outDir: 'providers/open-names/dist/umd' },
|
|
170
|
+
{ entryPath: './providers/openlayers/src/index.js', libraryPath: 'openLayersProvider', outDir: 'providers/openlayers/dist/umd' },
|
|
150
171
|
|
|
151
172
|
// Plugins
|
|
152
|
-
{ entryPath: './plugins/
|
|
153
|
-
{ entryPath: './plugins/
|
|
173
|
+
{ entryPath: './plugins/scale-bar/src/index.js', libraryPath: 'scaleBarPlugin', outDir: 'plugins/scale-bar/dist/umd' },
|
|
174
|
+
{ entryPath: './plugins/use-location/src/index.js', libraryPath: 'useLocationPlugin', outDir: 'plugins/use-location/dist/umd' },
|
|
154
175
|
{ entryPath: './plugins/search/src/index.js', libraryPath: 'searchPlugin', outDir: 'plugins/search/dist/umd' },
|
|
155
176
|
{ entryPath: './plugins/interact/src/index.js', libraryPath: 'interactPlugin', outDir: 'plugins/interact/dist/umd' },
|
|
156
177
|
{ entryPath: './plugins/datasets/src/index.js', libraryPath: 'datasetsPlugin', outDir: 'plugins/datasets/dist/umd', cssOutDir: 'plugins/datasets/dist' },
|
|
157
178
|
{ entryPath: './plugins/map-key/src/index.js', libraryPath: 'mapKeyPlugin', outDir: 'plugins/map-key/dist/umd', cssOutDir: 'plugins/map-key/dist' },
|
|
158
179
|
{ entryPath: './plugins/menu/src/index.js', libraryPath: 'menuPlugin', outDir: 'plugins/menu/dist/umd', cssOutDir: 'plugins/menu/dist' },
|
|
159
|
-
{ entryPath: './plugins/
|
|
180
|
+
{ entryPath: './plugins/map-styles/src/index.js', libraryPath: 'mapStylesPlugin', outDir: 'plugins/map-styles/dist/umd' },
|
|
160
181
|
{ entryPath: './plugins/draw/src/index.js', libraryPath: 'drawPlugin', outDir: 'plugins/draw/dist/umd' },
|
|
161
|
-
{ entryPath: './plugins/
|
|
162
|
-
{ entryPath: './plugins/beta/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/beta/frame/dist/umd' }
|
|
182
|
+
{ entryPath: './plugins/frame/src/index.js', libraryPath: 'framePlugin', outDir: 'plugins/frame/dist/umd' }
|
|
163
183
|
]
|
|
164
184
|
|
|
165
185
|
// === Filter via environment variable ===
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import{useEffect as t}from"preact/compat";import r from"@arcgis/core/widgets/Sketch/SketchViewModel.js";import a from"@arcgis/core/layers/GraphicsLayer.js";import o from"@babel/runtime/helpers/asyncToGenerator";import*as n from"@arcgis/core/geometry/operators/simplifyOperator.js";import i from"@arcgis/core/Graphic.js";function p(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function l(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?p(Object(a),!0).forEach(function(r){e(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):p(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}var c={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"},s="[interactive-map]",u=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.warn(s,...t)},d=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return console.error(s,...t)};function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function y(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?m(Object(a),!0).forEach(function(r){e(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):m(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}function v(e){return{type:"simple-fill",color:[0,120,255,.2],style:"none",outline:{color:"dark"===e?"#ffffff":"#d4351c",width:2}}}function E(e,t,r){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},{simplify:o=!0,allowHoles:p=!1}=a,l=new i({geometry:{type:"polygon",rings:t,spatialReference:27700},attributes:{id:e},symbol:v(r)});return o||!1===p?((e,t)=>{var{simplify:r=!0,allowHoles:a=!1}=t;return!r||n.isSimple(e.geometry)||(u("Feature geometry is not simple, attempting to simplify"),e.geometry=n.execute(e.geometry),n.isSimple(e.geometry))?!1===a&&(null==e?void 0:e.geometry.rings.length)>1?(d("Feature contains multiple polygons, which are not supported."),null):e:(d("Failed to simplify geometry, cannot add feature"),null)})(l,a):l}function g(e){if(null==e||!e.geometry)throw new Error("Invalid graphic");var{geometry:t,attributes:r={}}=e;switch(t.type){case"point":return{type:"Feature",geometry:{type:"Point",coordinates:[t.x,t.y]},properties:y({},r)};case"polyline":return{type:"Feature",geometry:{type:"LineString",coordinates:t.paths[0]},properties:y({},r)};case"polygon":return{type:"Feature",geometry:{type:"Polygon",coordinates:t.rings},properties:y({},r)};default:throw new Error("Unsupported geometry type: ".concat(t.type))}}var h=(e,t)=>{var{top:r,right:a,bottom:o,left:n}=e.padding,i=e.extent.clone(),{resolution:p}=e;i.xmin-=n*p,i.xmax+=a*p,i.ymin-=o*p,i.ymax+=r*p;var l={top:0,right:0,bottom:0,left:0};e.padding=l,e.extent=i,t({type:"SET_SAFE_ZONE_INSET",payload:{safeZoneInset:l,syncMapPadding:!1}})};function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,a)}return r}function P(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?f(Object(a),!0).forEach(function(r){e(t,r,a[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):f(Object(a)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))})}return t}var _={mobile:{slot:"actions",showLabel:!0},tablet:{slot:"actions",showLabel:!0},desktop:{slot:"actions",showLabel:!0}},S={reducer:{initialState:{mode:null,feature:null,featureId:null,tempFeature:null},actions:{SET_MODE:(e,t)=>{var r=t?e.featureId:null;return l(l({},e),{},{featureId:r,mode:t})},SET_FEATURE:(e,t)=>l(l({},e),{},{feature:void 0===t.feature?e.feature:t.feature,tempFeature:void 0===t.tempFeature?e.tempFeature:t.tempFeature}),SET_FEATURE_ID:(e,t)=>l(l({},e),{},{featureId:t})}},InitComponent:e=>{var{appState:i,mapState:p,pluginConfig:l,pluginState:s,services:u,mapProvider:d,buttonConfig:m}=e,{eventBus:y}=u,{mapColorScheme:h}=p.mapStyle||{},f=p.isMapReady;t(()=>{if(f&&!d.sketchViewModel){var{sketchViewModel:e,sketchLayer:t,emptySketchLayer:o}=(e=>{var{mapProvider:t}=e,{view:o}=t,n=new a({id:"sketchLayer"});o.map.add(n);var i=new a({id:"emptySketchLayer"});return o.map.add(i),{sketchViewModel:new r({view:o,layer:i,defaultUpdateOptions:{tool:"reshape",updateOnGraphicClick:!1,multipleSelectionEnabled:!1,toggleToolOnClick:!1,highlightOptions:{enabled:!1}}}),emptySketchLayer:i,sketchLayer:n}})({mapProvider:d});return d.sketchViewModel=e,d.sketchLayer=t,d.emptySketchLayer=o,y.emit("draw:ready"),()=>{d.sketchViewModel=null,d.sketchLayer=null,d.emptySketchLayer=null}}},[p.isMapReady]),t(()=>{if(f&&d.sketchViewModel){var e=function(e){var{pluginState:t,mapProvider:r,events:a,eventBus:i,buttonConfig:p,mapColorScheme:l}=e,{view:c,sketchViewModel:s,sketchLayer:u,emptySketchLayer:d}=r;if(!s)return null;var{drawDone:m,drawCancel:y}=p,{dispatch:h,mode:f,feature:P}=t,_=function(){var e=o(function*(){var e,r=null===(e=t.feature)||void 0===e||null===(e=e.properties)||void 0===e?void 0:e.id,a=null,o="active"===s.state&&!r;if("active"===s.state&&r&&(s.cancel(),yield new Promise(e=>setTimeout(e,50))),s.polygonSymbol=v(l),null==u||u.graphics.items.forEach(e=>{var t=E(e.attributes.id,e.geometry.rings,l);t&&(e.symbol=t.symbol),r===e.attributes.id&&(a=e)}),a&&!o&&s.layer===u)try{yield s.update(a,{tool:"reshape",toggleToolOnClick:!1})}catch(e){"AbortError"!==e.name&&console.error("Error updating sketch:",e)}});return function(){return e.apply(this,arguments)}}(),S=()=>{var e,t,r=null!==(e=null===(t=u.graphics)||void 0===t||null===(t=t.items)||void 0===t?void 0:t[0])&&void 0!==e?e:null;r&&setTimeout(()=>s.update(r),0)},A=()=>_(),O=e=>{if(e){var t=g(e);i.emit("draw:updated",t),h({type:"SET_FEATURE",payload:{tempFeature:t}})}},T=function(){var e=o(function*(){f&&((s.updateGraphics||[]).length||S())});return function(){return e.apply(this,arguments)}}(),b=function(){var e=o(function*(e){var{toolEventInfo:t}=e,r=null==e?void 0:e.graphic;if(r&&"vertex-add"===(null==t?void 0:t.type)){var a,o,n=null===(a=r.geometry)||void 0===a?void 0:a.rings;(null==n?void 0:n.length)>1?setTimeout(()=>s.undo(),0):(null==n||null===(o=n[0])||void 0===o?void 0:o.length)>3&&O(r)}});return function(t){return e.apply(this,arguments)}}(),w=function(){var e=o(function*(e){var t,r=null==e||null===(t=e.graphics)||void 0===t?void 0:t[0];O(r)});return function(t){return e.apply(this,arguments)}}(),M=e=>{var r=E(e.id||e.properties.id||t.featureId,e.geometry.coordinates,l);r&&u.add(r)};i.on(a.MAP_STYLE_CHANGE,A);var k=s.on("update",e=>{var t,r=null===(t=e.toolEventInfo)||void 0===t?void 0:t.type,a=e.graphics[0];"move-start"===r&&(s.cancel(),S()),"reshape-stop"===r&&(n.isSimple(a.geometry)&&1===a.geometry.rings.length||s.undo()),"reshape-stop"!==r&&"vertex-remove"!==r||O(a)}),D=c.on("click",T),L=s.on("create",b),C=s.on("undo",w),I=m.onClick,j=y.onClick;return m.onClick=()=>{var e;null!=s&&null!==(e=s.layer)&&void 0!==e&&null!==(e=e.graphics)&&void 0!==e&&null!==(e=e.items)&&void 0!==e&&e.length||M(t.tempFeature),s.cancel(),s.layer=d,h({type:"SET_MODE",payload:null}),h({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),i.emit("draw:done",{newFeature:t.tempFeature})},y.onClick=()=>{s.cancel(),u.removeAll(),P&&M(P),s.layer=d,h({type:"SET_MODE",payload:null}),i.emit("draw:cancelled")},()=>{i.off(a.MAP_STYLE_CHANGE,A),k.remove(),D.remove(),L.remove(),C.remove(),m.onClick=I,y.onClick=j}}({pluginState:s,mapProvider:d,events:c,eventBus:y,buttonConfig:m,mapColorScheme:h});return()=>{e()}}},[f,h,s])},buttons:[P({id:"drawDone",label:"Done",variant:"primary",hiddenWhen:e=>{var{pluginState:t}=e;return!t.mode},enableWhen:e=>{var{pluginState:t}=e;return!!t.tempFeature}},_),P({id:"drawCancel",label:"Cancel",variant:"tertiary",hiddenWhen:e=>{var{pluginState:t}=e;return!t.mode}},_)],api:{newPolygon:(e,t)=>{var{appState:r,mapState:a,pluginState:o,mapProvider:n,services:i}=e,{dispatch:p}=o,{sketchViewModel:l,sketchLayer:c,view:s}=n,{eventBus:u}=i;l.layer=c,h(s,r.dispatch);var d=l.on("create",e=>{if("complete"===e.state){e.graphic.attributes={id:t},requestAnimationFrame(()=>{l.update(e.graphic,{tool:"reshape",toggleToolOnClick:!1})});var r=g(e.graphic);u.emit("draw:created",r),p({type:"SET_FEATURE",payload:{tempFeature:r}}),d.remove()}});l.polygonSymbol=v(a.mapStyle.mapColorScheme),l.create("polygon"),p({type:"SET_MODE",payload:"new-polygon"}),p({type:"SET_FEATURE_ID",payload:t})},editFeature:(e,t)=>{var{appState:r,pluginState:a,mapProvider:o}=e,{dispatch:n}=a,{sketchViewModel:i,sketchLayer:p,view:l}=o,c=p.graphics.items.find(e=>e.attributes.id===t),s=c.geometry.extent.clone();h(l,r.dispatch),s.expand(2),l.goTo(s),i.layer=p,i.update(c,{tool:"reshape",toggleToolOnClick:!1,enableRotation:!1,enableScaling:!1}),n({type:"SET_FEATURE",payload:{feature:g(c)}}),n({type:"SET_MODE",payload:"edit-feature"})},addFeature:function(e,t){var{pluginState:r,mapState:a,mapProvider:o,services:n}=e,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{dispatch:p}=r,{mapStyle:l}=a,{sketchViewModel:c,sketchLayer:s,emptySketchLayer:u}=o,{eventBus:d}=n,m=E(t.id,t.geometry.coordinates,l.mapColorScheme,i),y={success:!0};return m?(s.add(m),c.layer=u,p({type:"SET_FEATURE",payload:{feature:t}}),d.emit("draw:add",t),y):(y.success=!1,y)},deleteFeature:(e,t)=>{var{pluginState:r,mapProvider:a,services:o}=e,{dispatch:n}=r,{sketchViewModel:i,sketchLayer:p,emptySketchLayer:l}=a,{eventBus:c}=o,s=p.graphics.items.find(e=>e.attributes.id===t);i.cancel(),p.remove(s),i.layer=l,n({type:"SET_FEATURE",payload:{feature:null,tempFeature:null}}),c.emit("draw:delete",{featureId:t}),n({type:"SET_MODE",payload:null})}}};export{S as manifest};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import r from"@babel/runtime/helpers/defineProperty";function t(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,n)}return t}function n(e){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?t(Object(o),!0).forEach(function(t){r(e,t,o[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):t(Object(o)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))})}return e}function o(){var r;return n(n({},arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),{},{id:"draw",load:(r=e(function*(){return(yield import(/* webpackChunkName: "im-draw-es-plugin" */ "./im-draw-es-plugin.js")).manifest}),function(){return r.apply(this,arguments)})})}export{o as default};
|