@mailwoman/react 11.0.0 → 11.2.0
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 +3 -3
- package/fonts.css +3 -0
- package/lib/common/About.tsx +6 -5
- package/lib/common/ClientOnly.tsx +6 -4
- package/lib/common/CopyButton.tsx +6 -5
- package/lib/common/KindBadge.tsx +8 -7
- package/lib/common/LoadingIndicator.tsx +7 -7
- package/lib/common/PresetChips.tsx +5 -5
- package/lib/common/confidence-tiers.ts +3 -3
- package/lib/common/cx.ts +6 -6
- package/lib/common/text-tokens.ts +4 -4
- package/lib/common/useBuildInfo.ts +5 -5
- package/lib/common/useClipboard.ts +5 -5
- package/lib/common/useDebouncedValue.ts +6 -6
- package/lib/common.ts +3 -3
- package/lib/index.ts +2 -5
- package/lib/map/AppIdentity.tsx +5 -6
- package/lib/map/CompareToggle.tsx +5 -5
- package/lib/map/DebugInfo.tsx +3 -4
- package/lib/map/Geocoder.tsx +55 -17
- package/lib/map/GeocoderControls.tsx +140 -40
- package/lib/map/GraticuleLayer.tsx +6 -6
- package/lib/map/LoadLedgerList.tsx +96 -0
- package/lib/map/MapCanvas.tsx +19 -16
- package/lib/map/MapChipRow.tsx +3 -4
- package/lib/map/MapCompass.tsx +3 -4
- package/lib/map/MapContextMenu.tsx +206 -0
- package/lib/map/MapControlStack.tsx +3 -4
- package/lib/map/MapFooter.tsx +3 -6
- package/lib/map/MapPlaceCard.tsx +64 -0
- package/lib/map/MapProgressBar.tsx +5 -5
- package/lib/map/MapSearchBar.tsx +5 -4
- package/lib/map/MapSheet.tsx +4 -5
- package/lib/map/OverlayLayers.tsx +11 -10
- package/lib/map/PlaceAutocomplete.tsx +3 -4
- package/lib/map/PlaceMarker.tsx +10 -9
- package/lib/map/ResolvedPlaceLayers.tsx +2 -5
- package/lib/map/ResultCamera.tsx +138 -19
- package/lib/map/ResultOverlay.tsx +2 -5
- package/lib/map/ResultPanel.tsx +10 -5
- package/lib/map/StarfieldLayer.tsx +7 -6
- package/lib/map/VersionPicker.tsx +5 -5
- package/lib/map/fake-runtime.ts +2 -5
- package/lib/map/geometry.ts +3 -6
- package/lib/map/graticule.ts +6 -6
- package/lib/map/jump-curtain.ts +105 -0
- package/lib/map/map-debug.ts +4 -4
- package/lib/map/place-render.ts +32 -14
- package/lib/map/reduced-motion.ts +13 -0
- package/lib/map/starfield.ts +9 -8
- package/lib/map/types.ts +13 -4
- package/lib/map/useCompareState.ts +10 -7
- package/lib/map/useGeocode.ts +42 -12
- package/lib/map/useMapBearing.ts +7 -7
- package/lib/map/useMapPick.ts +277 -0
- package/lib/map/useMapPlaceRender.ts +5 -5
- package/lib/map/usePlaceAutocomplete.ts +2 -5
- package/lib/map.ts +21 -8
- package/lib/network/ReachabilityProvider.tsx +6 -7
- package/lib/pipeline/CandidatePicker.tsx +18 -11
- package/lib/pipeline/ComponentTable.tsx +5 -5
- package/lib/pipeline/ConfidenceCell.tsx +6 -5
- package/lib/pipeline/FailureDiagnostic.tsx +5 -6
- package/lib/pipeline/MatchTable.tsx +46 -0
- package/lib/pipeline/PipelineExplorer.tsx +8 -7
- package/lib/pipeline/QueryForm.tsx +6 -5
- package/lib/pipeline/ResolvedPlace.tsx +6 -6
- package/lib/pipeline/SpanHighlight.tsx +7 -6
- package/lib/pipeline/TimingPanel.tsx +7 -6
- package/lib/pipeline/TreeView.tsx +5 -5
- package/lib/pipeline/copy.ts +6 -6
- package/lib/pipeline/presets.ts +7 -6
- package/lib/pipeline/types.ts +17 -5
- package/lib/pipeline/useParsePipeline.ts +50 -23
- package/lib/pipeline.ts +3 -3
- package/lib/poi/AbstainPanel.tsx +6 -5
- package/lib/poi/LiveResultsBlock.tsx +7 -6
- package/lib/poi/OverpassBlock.tsx +7 -5
- package/lib/poi/POIExplorer.tsx +2 -5
- package/lib/poi/QueryInput.tsx +5 -5
- package/lib/poi/SubjectPanel.tsx +9 -6
- package/lib/poi/runtime.ts +2 -5
- package/lib/poi/types.ts +6 -5
- package/lib/poi/usePOISearch.ts +78 -50
- package/lib/poi.ts +3 -3
- package/lib/runtime/useReleaseRuntime.ts +77 -8
- package/lib/runtime.ts +3 -3
- package/lib/search/SearchModal.tsx +13 -9
- package/lib/search/search.css +3 -0
- package/lib/search/tokens.ts +7 -6
- package/lib/search/types.ts +6 -6
- package/lib/search.ts +3 -3
- package/out/common/About.d.ts +3 -5
- package/out/common/About.d.ts.map +1 -1
- package/out/common/About.js.map +1 -1
- package/out/common/ClientOnly.d.ts +3 -4
- package/out/common/ClientOnly.d.ts.map +1 -1
- package/out/common/ClientOnly.js +5 -4
- package/out/common/ClientOnly.js.map +1 -1
- package/out/common/CopyButton.d.ts +3 -5
- package/out/common/CopyButton.d.ts.map +1 -1
- package/out/common/CopyButton.js.map +1 -1
- package/out/common/KindBadge.d.ts +5 -7
- package/out/common/KindBadge.d.ts.map +1 -1
- package/out/common/KindBadge.js.map +1 -1
- package/out/common/LoadingIndicator.d.ts +0 -10
- package/out/common/LoadingIndicator.d.ts.map +1 -1
- package/out/common/LoadingIndicator.js +6 -7
- package/out/common/LoadingIndicator.js.map +1 -1
- package/out/common/PresetChips.d.ts +2 -5
- package/out/common/PresetChips.d.ts.map +1 -1
- package/out/common/confidence-tiers.d.ts +0 -3
- package/out/common/confidence-tiers.d.ts.map +1 -1
- package/out/common/confidence-tiers.js +2 -3
- package/out/common/confidence-tiers.js.map +1 -1
- package/out/common/cx.d.ts +3 -6
- package/out/common/cx.d.ts.map +1 -1
- package/out/common/cx.js +2 -9
- package/out/common/cx.js.map +1 -1
- package/out/common/text-tokens.d.ts +1 -4
- package/out/common/text-tokens.d.ts.map +1 -1
- package/out/common/text-tokens.js +2 -11
- package/out/common/text-tokens.js.map +1 -1
- package/out/common/useBuildInfo.d.ts +0 -7
- package/out/common/useBuildInfo.d.ts.map +1 -1
- package/out/common/useBuildInfo.js +4 -5
- package/out/common/useBuildInfo.js.map +1 -1
- package/out/common/useClipboard.d.ts +0 -7
- package/out/common/useClipboard.d.ts.map +1 -1
- package/out/common/useClipboard.js +4 -5
- package/out/common/useClipboard.js.map +1 -1
- package/out/common/useDebouncedValue.d.ts +0 -9
- package/out/common/useDebouncedValue.d.ts.map +1 -1
- package/out/common/useDebouncedValue.js +5 -6
- package/out/common/useDebouncedValue.js.map +1 -1
- package/out/common.d.ts +0 -3
- package/out/common.d.ts.map +1 -1
- package/out/common.js +2 -3
- package/out/common.js.map +1 -1
- package/out/index.d.ts +0 -5
- package/out/index.d.ts.map +1 -1
- package/out/index.js +2 -5
- package/out/index.js.map +1 -1
- package/out/map/AppIdentity.d.ts +2 -6
- package/out/map/AppIdentity.d.ts.map +1 -1
- package/out/map/AppIdentity.js.map +1 -1
- package/out/map/CompareToggle.d.ts +2 -5
- package/out/map/CompareToggle.d.ts.map +1 -1
- package/out/map/DebugInfo.d.ts +0 -4
- package/out/map/DebugInfo.d.ts.map +1 -1
- package/out/map/DebugInfo.js +2 -4
- package/out/map/DebugInfo.js.map +1 -1
- package/out/map/Geocoder.d.ts +21 -9
- package/out/map/Geocoder.d.ts.map +1 -1
- package/out/map/Geocoder.js +15 -10
- package/out/map/Geocoder.js.map +1 -1
- package/out/map/GeocoderControls.d.ts +7 -9
- package/out/map/GeocoderControls.d.ts.map +1 -1
- package/out/map/GeocoderControls.js +99 -31
- package/out/map/GeocoderControls.js.map +1 -1
- package/out/map/GraticuleLayer.d.ts +3 -6
- package/out/map/GraticuleLayer.d.ts.map +1 -1
- package/out/map/GraticuleLayer.js +5 -6
- package/out/map/GraticuleLayer.js.map +1 -1
- package/out/map/LoadLedgerList.d.ts +19 -0
- package/out/map/LoadLedgerList.d.ts.map +1 -0
- package/out/map/LoadLedgerList.js +59 -0
- package/out/map/LoadLedgerList.js.map +1 -0
- package/out/map/MapCanvas.d.ts +2 -24
- package/out/map/MapCanvas.d.ts.map +1 -1
- package/out/map/MapCanvas.js +16 -14
- package/out/map/MapCanvas.js.map +1 -1
- package/out/map/MapChipRow.d.ts +0 -4
- package/out/map/MapChipRow.d.ts.map +1 -1
- package/out/map/MapChipRow.js.map +1 -1
- package/out/map/MapCompass.d.ts +0 -4
- package/out/map/MapCompass.d.ts.map +1 -1
- package/out/map/MapCompass.js.map +1 -1
- package/out/map/MapContextMenu.d.ts +88 -0
- package/out/map/MapContextMenu.d.ts.map +1 -0
- package/out/map/MapContextMenu.js +96 -0
- package/out/map/MapContextMenu.js.map +1 -0
- package/out/map/MapControlStack.d.ts +0 -4
- package/out/map/MapControlStack.d.ts.map +1 -1
- package/out/map/MapControlStack.js.map +1 -1
- package/out/map/MapFooter.d.ts +1 -6
- package/out/map/MapFooter.d.ts.map +1 -1
- package/out/map/MapFooter.js +2 -5
- package/out/map/MapFooter.js.map +1 -1
- package/out/map/MapPlaceCard.d.ts +17 -0
- package/out/map/MapPlaceCard.d.ts.map +1 -0
- package/out/map/MapPlaceCard.js +27 -0
- package/out/map/MapPlaceCard.js.map +1 -0
- package/out/map/MapProgressBar.d.ts +2 -5
- package/out/map/MapProgressBar.d.ts.map +1 -1
- package/out/map/MapSearchBar.d.ts +2 -4
- package/out/map/MapSearchBar.d.ts.map +1 -1
- package/out/map/MapSearchBar.js.map +1 -1
- package/out/map/MapSheet.d.ts +1 -5
- package/out/map/MapSheet.d.ts.map +1 -1
- package/out/map/MapSheet.js +2 -4
- package/out/map/MapSheet.js.map +1 -1
- package/out/map/OverlayLayers.d.ts +8 -10
- package/out/map/OverlayLayers.d.ts.map +1 -1
- package/out/map/OverlayLayers.js +10 -10
- package/out/map/OverlayLayers.js.map +1 -1
- package/out/map/PlaceAutocomplete.d.ts +0 -4
- package/out/map/PlaceAutocomplete.d.ts.map +1 -1
- package/out/map/PlaceAutocomplete.js.map +1 -1
- package/out/map/PlaceMarker.d.ts +0 -13
- package/out/map/PlaceMarker.d.ts.map +1 -1
- package/out/map/PlaceMarker.js +9 -9
- package/out/map/PlaceMarker.js.map +1 -1
- package/out/map/ResolvedPlaceLayers.d.ts +0 -5
- package/out/map/ResolvedPlaceLayers.d.ts.map +1 -1
- package/out/map/ResolvedPlaceLayers.js.map +1 -1
- package/out/map/ResultCamera.d.ts +53 -7
- package/out/map/ResultCamera.d.ts.map +1 -1
- package/out/map/ResultCamera.js +103 -17
- package/out/map/ResultCamera.js.map +1 -1
- package/out/map/ResultOverlay.d.ts +0 -5
- package/out/map/ResultOverlay.d.ts.map +1 -1
- package/out/map/ResultOverlay.js +2 -5
- package/out/map/ResultOverlay.js.map +1 -1
- package/out/map/ResultPanel.d.ts +0 -5
- package/out/map/ResultPanel.d.ts.map +1 -1
- package/out/map/ResultPanel.js +2 -1
- package/out/map/ResultPanel.js.map +1 -1
- package/out/map/StarfieldLayer.d.ts +0 -11
- package/out/map/StarfieldLayer.d.ts.map +1 -1
- package/out/map/StarfieldLayer.js +6 -6
- package/out/map/StarfieldLayer.js.map +1 -1
- package/out/map/VersionPicker.d.ts +2 -5
- package/out/map/VersionPicker.d.ts.map +1 -1
- package/out/map/fake-runtime.d.ts +0 -5
- package/out/map/fake-runtime.d.ts.map +1 -1
- package/out/map/fake-runtime.js +2 -5
- package/out/map/fake-runtime.js.map +1 -1
- package/out/map/geometry.d.ts +1 -6
- package/out/map/geometry.d.ts.map +1 -1
- package/out/map/geometry.js +3 -6
- package/out/map/geometry.js.map +1 -1
- package/out/map/graticule.d.ts +3 -6
- package/out/map/graticule.d.ts.map +1 -1
- package/out/map/graticule.js +2 -9
- package/out/map/graticule.js.map +1 -1
- package/out/map/jump-curtain.d.ts +61 -0
- package/out/map/jump-curtain.d.ts.map +1 -0
- package/out/map/jump-curtain.js +69 -0
- package/out/map/jump-curtain.js.map +1 -0
- package/out/map/map-debug.d.ts +1 -4
- package/out/map/map-debug.d.ts.map +1 -1
- package/out/map/map-debug.js +2 -10
- package/out/map/map-debug.js.map +1 -1
- package/out/map/place-render.d.ts +5 -6
- package/out/map/place-render.d.ts.map +1 -1
- package/out/map/place-render.js +21 -12
- package/out/map/place-render.js.map +1 -1
- package/out/map/reduced-motion.d.ts +9 -0
- package/out/map/reduced-motion.d.ts.map +1 -0
- package/out/map/reduced-motion.js +13 -0
- package/out/map/reduced-motion.js.map +1 -0
- package/out/map/starfield.d.ts +0 -14
- package/out/map/starfield.d.ts.map +1 -1
- package/out/map/starfield.js +8 -8
- package/out/map/starfield.js.map +1 -1
- package/out/map/types.d.ts +10 -4
- package/out/map/types.d.ts.map +1 -1
- package/out/map/types.js +2 -7
- package/out/map/types.js.map +1 -1
- package/out/map/useCompareState.d.ts +0 -11
- package/out/map/useCompareState.d.ts.map +1 -1
- package/out/map/useCompareState.js +9 -7
- package/out/map/useCompareState.js.map +1 -1
- package/out/map/useGeocode.d.ts +13 -20
- package/out/map/useGeocode.d.ts.map +1 -1
- package/out/map/useGeocode.js +21 -11
- package/out/map/useGeocode.js.map +1 -1
- package/out/map/useMapBearing.d.ts +2 -9
- package/out/map/useMapBearing.d.ts.map +1 -1
- package/out/map/useMapBearing.js +4 -5
- package/out/map/useMapBearing.js.map +1 -1
- package/out/map/useMapPick.d.ts +28 -0
- package/out/map/useMapPick.d.ts.map +1 -0
- package/out/map/useMapPick.js +206 -0
- package/out/map/useMapPick.js.map +1 -0
- package/out/map/useMapPlaceRender.d.ts +0 -7
- package/out/map/useMapPlaceRender.d.ts.map +1 -1
- package/out/map/useMapPlaceRender.js +4 -5
- package/out/map/useMapPlaceRender.js.map +1 -1
- package/out/map/usePlaceAutocomplete.d.ts +0 -5
- package/out/map/usePlaceAutocomplete.d.ts.map +1 -1
- package/out/map/usePlaceAutocomplete.js +2 -5
- package/out/map/usePlaceAutocomplete.js.map +1 -1
- package/out/map.d.ts +10 -8
- package/out/map.d.ts.map +1 -1
- package/out/map.js +9 -8
- package/out/map.js.map +1 -1
- package/out/network/ReachabilityProvider.d.ts +3 -7
- package/out/network/ReachabilityProvider.d.ts.map +1 -1
- package/out/network/ReachabilityProvider.js +5 -7
- package/out/network/ReachabilityProvider.js.map +1 -1
- package/out/pipeline/CandidatePicker.d.ts +15 -11
- package/out/pipeline/CandidatePicker.d.ts.map +1 -1
- package/out/pipeline/CandidatePicker.js.map +1 -1
- package/out/pipeline/ComponentTable.d.ts +2 -5
- package/out/pipeline/ComponentTable.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.d.ts +0 -8
- package/out/pipeline/ConfidenceCell.d.ts.map +1 -1
- package/out/pipeline/ConfidenceCell.js +5 -5
- package/out/pipeline/ConfidenceCell.js.map +1 -1
- package/out/pipeline/FailureDiagnostic.d.ts +2 -6
- package/out/pipeline/FailureDiagnostic.d.ts.map +1 -1
- package/out/pipeline/FailureDiagnostic.js.map +1 -1
- package/out/pipeline/MatchTable.d.ts +7 -0
- package/out/pipeline/MatchTable.d.ts.map +1 -0
- package/out/pipeline/MatchTable.js +18 -0
- package/out/pipeline/MatchTable.js.map +1 -0
- package/out/pipeline/PipelineExplorer.d.ts +5 -7
- package/out/pipeline/PipelineExplorer.d.ts.map +1 -1
- package/out/pipeline/PipelineExplorer.js.map +1 -1
- package/out/pipeline/QueryForm.d.ts +3 -5
- package/out/pipeline/QueryForm.d.ts.map +1 -1
- package/out/pipeline/QueryForm.js.map +1 -1
- package/out/pipeline/ResolvedPlace.d.ts +2 -5
- package/out/pipeline/ResolvedPlace.d.ts.map +1 -1
- package/out/pipeline/SpanHighlight.d.ts +4 -6
- package/out/pipeline/SpanHighlight.d.ts.map +1 -1
- package/out/pipeline/SpanHighlight.js.map +1 -1
- package/out/pipeline/TimingPanel.d.ts +4 -6
- package/out/pipeline/TimingPanel.d.ts.map +1 -1
- package/out/pipeline/TimingPanel.js.map +1 -1
- package/out/pipeline/TreeView.d.ts +2 -5
- package/out/pipeline/TreeView.d.ts.map +1 -1
- package/out/pipeline/copy.d.ts +0 -8
- package/out/pipeline/copy.d.ts.map +1 -1
- package/out/pipeline/copy.js +5 -6
- package/out/pipeline/copy.js.map +1 -1
- package/out/pipeline/presets.d.ts +3 -5
- package/out/pipeline/presets.d.ts.map +1 -1
- package/out/pipeline/presets.js +3 -9
- package/out/pipeline/presets.js.map +1 -1
- package/out/pipeline/types.d.ts +14 -5
- package/out/pipeline/types.d.ts.map +1 -1
- package/out/pipeline/types.js +2 -8
- package/out/pipeline/types.js.map +1 -1
- package/out/pipeline/useParsePipeline.d.ts +6 -6
- package/out/pipeline/useParsePipeline.d.ts.map +1 -1
- package/out/pipeline/useParsePipeline.js +38 -26
- package/out/pipeline/useParsePipeline.js.map +1 -1
- package/out/pipeline.d.ts +0 -3
- package/out/pipeline.d.ts.map +1 -1
- package/out/pipeline.js +2 -3
- package/out/pipeline.js.map +1 -1
- package/out/poi/AbstainPanel.d.ts +3 -5
- package/out/poi/AbstainPanel.d.ts.map +1 -1
- package/out/poi/AbstainPanel.js.map +1 -1
- package/out/poi/LiveResultsBlock.d.ts +4 -6
- package/out/poi/LiveResultsBlock.d.ts.map +1 -1
- package/out/poi/LiveResultsBlock.js.map +1 -1
- package/out/poi/OverpassBlock.d.ts +4 -5
- package/out/poi/OverpassBlock.d.ts.map +1 -1
- package/out/poi/OverpassBlock.js.map +1 -1
- package/out/poi/POIExplorer.d.ts +0 -5
- package/out/poi/POIExplorer.d.ts.map +1 -1
- package/out/poi/POIExplorer.js +2 -5
- package/out/poi/POIExplorer.js.map +1 -1
- package/out/poi/QueryInput.d.ts +2 -5
- package/out/poi/QueryInput.d.ts.map +1 -1
- package/out/poi/SubjectPanel.d.ts +6 -6
- package/out/poi/SubjectPanel.d.ts.map +1 -1
- package/out/poi/SubjectPanel.js.map +1 -1
- package/out/poi/runtime.d.ts +0 -5
- package/out/poi/runtime.d.ts.map +1 -1
- package/out/poi/runtime.js +2 -5
- package/out/poi/runtime.js.map +1 -1
- package/out/poi/types.d.ts +3 -5
- package/out/poi/types.d.ts.map +1 -1
- package/out/poi/types.js +2 -8
- package/out/poi/types.js.map +1 -1
- package/out/poi/usePOISearch.d.ts +7 -5
- package/out/poi/usePOISearch.d.ts.map +1 -1
- package/out/poi/usePOISearch.js +24 -10
- package/out/poi/usePOISearch.js.map +1 -1
- package/out/poi.d.ts +0 -3
- package/out/poi.d.ts.map +1 -1
- package/out/poi.js +2 -3
- package/out/poi.js.map +1 -1
- package/out/runtime/useReleaseRuntime.d.ts +33 -7
- package/out/runtime/useReleaseRuntime.d.ts.map +1 -1
- package/out/runtime/useReleaseRuntime.js +36 -6
- package/out/runtime/useReleaseRuntime.js.map +1 -1
- package/out/runtime.d.ts +0 -3
- package/out/runtime.d.ts.map +1 -1
- package/out/runtime.js +2 -3
- package/out/runtime.js.map +1 -1
- package/out/search/SearchModal.d.ts +0 -12
- package/out/search/SearchModal.d.ts.map +1 -1
- package/out/search/SearchModal.js +12 -9
- package/out/search/SearchModal.js.map +1 -1
- package/out/search/tokens.d.ts +4 -6
- package/out/search/tokens.d.ts.map +1 -1
- package/out/search/tokens.js +6 -6
- package/out/search/tokens.js.map +1 -1
- package/out/search/types.d.ts +3 -6
- package/out/search/types.d.ts.map +1 -1
- package/out/search/types.js +4 -5
- package/out/search/types.js.map +1 -1
- package/out/search.d.ts +0 -3
- package/out/search.d.ts.map +1 -1
- package/out/search.js +2 -3
- package/out/search.js.map +1 -1
- package/package.json +7 -6
- package/styles.css +214 -3
- package/tokens/index.css +3 -0
- package/lib/map/useMapLabelPick.ts +0 -114
- package/out/map/useMapLabelPick.d.ts +0 -13
- package/out/map/useMapLabelPick.d.ts.map +0 -1
- package/out/map/useMapLabelPick.js +0 -95
- package/out/map/useMapLabelPick.js.map +0 -1
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The map's right-click menu: a glass panel at the pointer with rows the host supplies,
|
|
6
|
+
* each a label, a value and a copy button, and actions beneath them. {@link useMapContextMenu}
|
|
7
|
+
* reads the map's `contextmenu` event and closes the menu when the map moves.
|
|
8
|
+
*
|
|
9
|
+
* The menu itself closes on Escape and on a pointer press outside it,
|
|
10
|
+
* as the footer's sources popover does.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { type ReactNode, useCallback, useEffect, useRef, useState } from "react"
|
|
14
|
+
import type { MapInstance, MapLayerMouseEvent } from "react-map-gl/maplibre"
|
|
15
|
+
|
|
16
|
+
import { cx } from "#common/cx"
|
|
17
|
+
import type { LngLat } from "#map/place-render"
|
|
18
|
+
|
|
19
|
+
import { CopyButton } from "../common/CopyButton.tsx"
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Where the menu opened: the point under the pointer and its place on the map container.
|
|
23
|
+
*/
|
|
24
|
+
export interface MapContextMenuPoint {
|
|
25
|
+
lngLat: LngLat
|
|
26
|
+
zoom: number
|
|
27
|
+
/**
|
|
28
|
+
* The pointer's position in the map container, in CSS pixels.
|
|
29
|
+
*/
|
|
30
|
+
x: number
|
|
31
|
+
y: number
|
|
32
|
+
/**
|
|
33
|
+
* The map container's size when the menu opened, so the menu can open toward the inside.
|
|
34
|
+
*/
|
|
35
|
+
width: number
|
|
36
|
+
height: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The open menu's point and a way to close it.
|
|
41
|
+
*/
|
|
42
|
+
export interface UseMapContextMenu {
|
|
43
|
+
point: MapContextMenuPoint | null
|
|
44
|
+
close: () => void
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Opens the menu on the map's `contextmenu` event and closes it when the map starts to move.
|
|
49
|
+
*/
|
|
50
|
+
export function useMapContextMenu(map: MapInstance | null): UseMapContextMenu {
|
|
51
|
+
const [point, setPoint] = useState<MapContextMenuPoint | null>(null)
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!map) return
|
|
55
|
+
|
|
56
|
+
const onContextMenu = (event: MapLayerMouseEvent) => {
|
|
57
|
+
event.preventDefault()
|
|
58
|
+
|
|
59
|
+
const container = map.getContainer()
|
|
60
|
+
const lngLat = event.lngLat.wrap()
|
|
61
|
+
|
|
62
|
+
setPoint({
|
|
63
|
+
lngLat: [lngLat.lng, lngLat.lat],
|
|
64
|
+
zoom: map.getZoom(),
|
|
65
|
+
x: event.point.x,
|
|
66
|
+
y: event.point.y,
|
|
67
|
+
width: container.clientWidth,
|
|
68
|
+
height: container.clientHeight,
|
|
69
|
+
})
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const close = () => setPoint(null)
|
|
73
|
+
|
|
74
|
+
map.on("contextmenu", onContextMenu)
|
|
75
|
+
map.on("movestart", close)
|
|
76
|
+
|
|
77
|
+
return () => {
|
|
78
|
+
map.off("contextmenu", onContextMenu)
|
|
79
|
+
map.off("movestart", close)
|
|
80
|
+
setPoint(null)
|
|
81
|
+
}
|
|
82
|
+
}, [map])
|
|
83
|
+
|
|
84
|
+
const close = useCallback(() => setPoint(null), [])
|
|
85
|
+
|
|
86
|
+
return { point, close }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The menu's widest and tallest extent, used to decide which side of the pointer it opens on.
|
|
91
|
+
*/
|
|
92
|
+
const MENU_WIDTH = 320
|
|
93
|
+
const MENU_HEIGHT = 360
|
|
94
|
+
|
|
95
|
+
export interface MapContextMenuProps {
|
|
96
|
+
/**
|
|
97
|
+
* Where the menu is open, from {@link useMapContextMenu}.
|
|
98
|
+
*/
|
|
99
|
+
point: MapContextMenuPoint
|
|
100
|
+
/**
|
|
101
|
+
* The rows and actions, such as {@link MapContextMenuRow} and {@link MapContextMenuAction}.
|
|
102
|
+
*/
|
|
103
|
+
children: ReactNode
|
|
104
|
+
onClose: () => void
|
|
105
|
+
/**
|
|
106
|
+
* The menu's accessible name.
|
|
107
|
+
*
|
|
108
|
+
* @defaultValue `"Map point"`
|
|
109
|
+
*/
|
|
110
|
+
label?: string
|
|
111
|
+
className?: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The right-click menu, placed at its point and opened toward the inside of the map.
|
|
116
|
+
*/
|
|
117
|
+
export function MapContextMenu({ point, children, onClose, label = "Map point", className }: MapContextMenuProps) {
|
|
118
|
+
const root = useRef<HTMLDivElement>(null)
|
|
119
|
+
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
const onPointerDown = (event: PointerEvent) => {
|
|
122
|
+
if (!root.current?.contains(event.target as Node)) {
|
|
123
|
+
onClose()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const onKeyDown = (event: KeyboardEvent) => {
|
|
128
|
+
if (event.key === "Escape") {
|
|
129
|
+
onClose()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
document.addEventListener("pointerdown", onPointerDown)
|
|
134
|
+
document.addEventListener("keydown", onKeyDown)
|
|
135
|
+
|
|
136
|
+
return () => {
|
|
137
|
+
document.removeEventListener("pointerdown", onPointerDown)
|
|
138
|
+
document.removeEventListener("keydown", onKeyDown)
|
|
139
|
+
}
|
|
140
|
+
}, [onClose])
|
|
141
|
+
|
|
142
|
+
const flipX = point.x + MENU_WIDTH > point.width
|
|
143
|
+
const flipY = point.y + MENU_HEIGHT > point.height
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<div
|
|
147
|
+
ref={root}
|
|
148
|
+
className={cx("mw-map-menu", className)}
|
|
149
|
+
role="menu"
|
|
150
|
+
aria-label={label}
|
|
151
|
+
style={{
|
|
152
|
+
left: point.x,
|
|
153
|
+
top: point.y,
|
|
154
|
+
transform: `translate(${flipX ? "calc(-100% - 4px)" : "4px"}, ${flipY ? "calc(-100% - 4px)" : "4px"})`,
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
{children}
|
|
158
|
+
</div>
|
|
159
|
+
)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export interface MapContextMenuRowProps {
|
|
163
|
+
/**
|
|
164
|
+
* What the value is, such as `Plus code`.
|
|
165
|
+
*/
|
|
166
|
+
label: string
|
|
167
|
+
/**
|
|
168
|
+
* The value, shown in monospace and copied by the row's button.
|
|
169
|
+
*/
|
|
170
|
+
value: string
|
|
171
|
+
/**
|
|
172
|
+
* What the label stands for, shown on hover, such as `Open Location Code`.
|
|
173
|
+
*/
|
|
174
|
+
hint?: string
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* One row of the menu: a label, its value and a button that copies the value.
|
|
179
|
+
*/
|
|
180
|
+
export function MapContextMenuRow({ label, value, hint }: MapContextMenuRowProps): ReactNode {
|
|
181
|
+
return (
|
|
182
|
+
<div className="mw-map-menu__row" role="menuitem">
|
|
183
|
+
<span className="mw-map-menu__label" title={hint}>
|
|
184
|
+
{label}
|
|
185
|
+
</span>
|
|
186
|
+
<code className="mw-map-menu__value">{value}</code>
|
|
187
|
+
<CopyButton value={value} label="Copy" copiedLabel="Copied" className="mw-map-menu__copy" />
|
|
188
|
+
</div>
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export interface MapContextMenuActionProps {
|
|
193
|
+
children: ReactNode
|
|
194
|
+
onSelect: () => void
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* One action of the menu, a full-width button beneath the rows.
|
|
199
|
+
*/
|
|
200
|
+
export function MapContextMenuAction({ children, onSelect }: MapContextMenuActionProps): ReactNode {
|
|
201
|
+
return (
|
|
202
|
+
<button type="button" className="mw-map-menu__action" role="menuitem" onClick={onSelect}>
|
|
203
|
+
{children}
|
|
204
|
+
</button>
|
|
205
|
+
)
|
|
206
|
+
}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Provide accessible map-control buttons arranged in grouped capsules.
|
|
7
6
|
*/
|
|
8
7
|
|
package/lib/map/MapFooter.tsx
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { type ReactNode, useEffect, useId, useRef, useState } from "react"
|
|
8
5
|
|
|
@@ -14,7 +11,7 @@ export interface MapFooterProps {
|
|
|
14
11
|
*/
|
|
15
12
|
identity?: ReactNode
|
|
16
13
|
/**
|
|
17
|
-
* What
|
|
14
|
+
* What's loading right now, beside the identity.
|
|
18
15
|
*/
|
|
19
16
|
status?: ReactNode
|
|
20
17
|
/**
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The card a map click opens: what the click landed on, its coordinate, and the two
|
|
6
|
+
* things to do with it, search it through the geocoder or copy the coordinate.
|
|
7
|
+
*
|
|
8
|
+
* A feature with a name is titled by that name, and bare ground by its coordinate.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { coordinatePairText } from "@mailwoman/spatial/point/text"
|
|
12
|
+
import type { ReactNode } from "react"
|
|
13
|
+
|
|
14
|
+
import { cx } from "#common/cx"
|
|
15
|
+
import type { MapPick } from "#map/useMapPick"
|
|
16
|
+
|
|
17
|
+
import { CopyButton } from "../common/CopyButton.tsx"
|
|
18
|
+
import { SheetClose } from "./MapSheet.tsx"
|
|
19
|
+
|
|
20
|
+
export interface MapPlaceCardProps {
|
|
21
|
+
pick: MapPick
|
|
22
|
+
/**
|
|
23
|
+
* Search the card's subject: the feature's name, or the coordinate for bare ground.
|
|
24
|
+
*/
|
|
25
|
+
onSearch: (query: string) => void
|
|
26
|
+
onClose: () => void
|
|
27
|
+
className?: string
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The query the card searches: a name when the click had one, else the coordinate pair.
|
|
32
|
+
*/
|
|
33
|
+
export function pickQuery(pick: MapPick): string {
|
|
34
|
+
const [lon, lat] = pick.lngLat
|
|
35
|
+
|
|
36
|
+
return pick.name ?? coordinatePairText(lat, lon)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function MapPlaceCard({ pick, onSearch, onClose, className }: MapPlaceCardProps): ReactNode {
|
|
40
|
+
const [lon, lat] = pick.lngLat
|
|
41
|
+
const coordinates = coordinatePairText(lat, lon)
|
|
42
|
+
const title = pick.name ?? coordinates
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<aside className={cx("mw-map-card", className)} aria-label="Clicked place">
|
|
46
|
+
<div className="mw-map-card__body">
|
|
47
|
+
<h2 className="mw-map-card__title">{title}</h2>
|
|
48
|
+
<p className="mw-map-card__line">
|
|
49
|
+
{pick.placetype ? <span className="mw-map-card__kind">{pick.placetype}</span> : null}
|
|
50
|
+
{pick.name ? <code className="mw-map-card__coords">{coordinates}</code> : null}
|
|
51
|
+
</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div className="mw-map-card__actions">
|
|
55
|
+
<button type="button" className="mw-map-chip" onClick={() => onSearch(pickQuery(pick))}>
|
|
56
|
+
Search
|
|
57
|
+
</button>
|
|
58
|
+
<CopyButton value={coordinates} label="Copy coordinates" copiedLabel="Copied" className="mw-map-chip" />
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<SheetClose label="Close the place card" onClose={onClose} />
|
|
62
|
+
</aside>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Show loading progress at the top of the viewport.
|
|
6
|
+
*
|
|
7
7
|
* Use a determinate bar when progress is known, otherwise an indeterminate bar.
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -26,7 +26,7 @@ export interface MapProgressBarProps {
|
|
|
26
26
|
fraction?: number | null
|
|
27
27
|
/**
|
|
28
28
|
* The bar's accessible name.
|
|
29
|
-
* What
|
|
29
|
+
* What's loading, in a few words.
|
|
30
30
|
*/
|
|
31
31
|
label: string
|
|
32
32
|
className?: string
|
package/lib/map/MapSearchBar.tsx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* Presentational search pill for map UIs.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* The host supplies the input and icons.
|
|
7
8
|
* Busy state uses a bottom-edge indicator to avoid changing the pill layout.
|
|
8
9
|
*/
|
|
9
10
|
|
package/lib/map/MapSheet.tsx
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* Side panel over the map with a heading, close button and Escape dismissal.
|
|
7
6
|
*/
|
|
8
7
|
|
|
@@ -12,7 +11,7 @@ import { cx } from "#common/cx"
|
|
|
12
11
|
|
|
13
12
|
export interface SheetCloseProps {
|
|
14
13
|
/**
|
|
15
|
-
* What
|
|
14
|
+
* What's being closed, for the accessible name: "Close the result", "Close About".
|
|
16
15
|
*/
|
|
17
16
|
label: string
|
|
18
17
|
onClose: () => void
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `<OverlayLayers>` — renders the host-supplied {@link OverlaySpec}s
|
|
6
|
+
* (coverage "fog of war", race-dots, …) as declarative `<Source>` + `<Layer>`s.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* the host composes the specs, the package renders them, react-map-gl owns the add/remove lifecycle.
|
|
8
|
+
* This replaces the demo's imperative `map.addSource` / `map.addLayer` overlay loops
|
|
9
|
+
* (and their `isStyleLoaded()` / `styledata` guards): the host composes the specs,
|
|
10
|
+
* the package renders them, react-map-gl owns the add/remove lifecycle.
|
|
10
11
|
*
|
|
11
|
-
* Each overlay's `visible` flag flips the layers' `visibility` layout property —
|
|
12
|
-
* layer-toggle control drives in a later phase. node-import safety:
|
|
13
|
-
* reachable only via `@mailwoman/react/map`.
|
|
12
|
+
* Each overlay's `visible` flag flips the layers' `visibility` layout property —
|
|
13
|
+
* the declarative control a layer-toggle control drives in a later phase. node-import safety:
|
|
14
|
+
* imports `react-map-gl/maplibre` — reachable only via `@mailwoman/react/map`.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
17
|
import { Fragment, type ReactNode } from "react"
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* The `usePlaceAutocomplete` hook owns the state and keyboard navigation.
|
|
7
6
|
*/
|
|
8
7
|
|
package/lib/map/PlaceMarker.tsx
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `<PlaceMarker>` — the resolved-place pin, as a declarative `react-map-gl/maplibre` `<Marker>`.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* This replaces the old imperative `new maplibre.Marker(...).setLngLat(...).addTo(map)`
|
|
8
|
+
* (+ the manual `markerRef.current.remove()` teardown) from the demo's redraw effect:
|
|
9
|
+
* mounting/unmounting the marker is now React's job, keyed on the resolved candidate.
|
|
10
|
+
* Renders as a child of `<MapCanvas>`.
|
|
10
11
|
*
|
|
11
|
-
* node-import safety: imports `react-map-gl/maplibre` at module scope, so it is reachable
|
|
12
|
-
* the `@mailwoman/react/map` subpath, never the package root.
|
|
12
|
+
* node-import safety: imports `react-map-gl/maplibre` at module scope, so it is reachable
|
|
13
|
+
* only through the `@mailwoman/react/map` subpath, never the package root.
|
|
13
14
|
*/
|
|
14
15
|
|
|
15
16
|
import { Tokens } from "@sister.software/theme"
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { ReactNode } from "react"
|
|
8
5
|
|
package/lib/map/ResultCamera.tsx
CHANGED
|
@@ -1,22 +1,150 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
|
-
import
|
|
4
|
+
import { centralAngle, ConversionFactor } from "@mailwoman/spatial/distance"
|
|
5
|
+
import type { FitBoundsOptions, FlyToOptions, JumpToOptions, LngLatBoundsLike } from "maplibre-gl"
|
|
8
6
|
import { type ReactNode, useEffect } from "react"
|
|
9
7
|
import { useMap } from "react-map-gl/maplibre"
|
|
10
8
|
|
|
9
|
+
import { createJumpCurtain, JUMP_FADE_MS, type JumpCurtain } from "#map/jump-curtain"
|
|
11
10
|
import type { MapCameraTarget } from "#map/place-render"
|
|
11
|
+
import { prefersReducedMotion } from "#map/reduced-motion"
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The arc, in degrees of the body's great circle, past which a result's camera move
|
|
15
|
+
* jumps most of the way rather than animating across the globe.
|
|
16
|
+
*
|
|
17
|
+
* On Earth 13.5° is about 1,500 km, roughly New York to Chicago.
|
|
18
|
+
* An angle rather than a distance keeps the rule the same on the Moon and Mars.
|
|
19
|
+
*
|
|
20
|
+
* An animated move between continents draws every frame at an intermediate zoom.
|
|
21
|
+
* Each frame requests the basemap and elevation tiles under it, few of which the reader looks at.
|
|
22
|
+
*/
|
|
23
|
+
export const LONG_MOVE_DEGREES = 13.5
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The zoom a long move jumps to over its target before it animates in.
|
|
27
|
+
*
|
|
28
|
+
* At zoom 4 the view holds a few dozen tiles, so the jump costs little,
|
|
29
|
+
* and the animation from there requests only tiles over the target.
|
|
30
|
+
*/
|
|
31
|
+
export const LONG_MOVE_OVERVIEW_ZOOM = 4
|
|
12
32
|
|
|
13
33
|
/**
|
|
14
34
|
* Builds `fitBounds` options without an undefined `duration` key.
|
|
15
35
|
*
|
|
16
36
|
* MapLibre checks for existence and can turn into a NaN camera move.
|
|
17
37
|
*/
|
|
18
|
-
export function fitBoundsOptionsFor(padding: number, animate: boolean): FitBoundsOptions {
|
|
19
|
-
|
|
38
|
+
export function fitBoundsOptionsFor(padding: number, animate: boolean, maxZoom?: number): FitBoundsOptions {
|
|
39
|
+
const options: FitBoundsOptions = animate ? { padding } : { padding, duration: 0 }
|
|
40
|
+
|
|
41
|
+
if (typeof maxZoom === "number") {
|
|
42
|
+
options.maxZoom = maxZoom
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return options
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The point a camera target centers on.
|
|
50
|
+
*/
|
|
51
|
+
export function cameraTargetCenter(target: MapCameraTarget): [lon: number, lat: number] {
|
|
52
|
+
if (target.kind === "center") return [target.center[0], target.center[1]]
|
|
53
|
+
|
|
54
|
+
const [[west, south], [east, north]] = target.bounds
|
|
55
|
+
|
|
56
|
+
return [(west + east) / 2, (south + north) / 2]
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The map methods a camera move calls, a subset of MapLibre's `Map`.
|
|
61
|
+
*/
|
|
62
|
+
export interface CameraMap {
|
|
63
|
+
getCenter(): { lng: number; lat: number }
|
|
64
|
+
getZoom(): number
|
|
65
|
+
jumpTo(options: JumpToOptions): unknown
|
|
66
|
+
flyTo(options: FlyToOptions): unknown
|
|
67
|
+
fitBounds(bounds: LngLatBoundsLike, options?: FitBoundsOptions): unknown
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The overview jump a move longer than {@linkcode LONG_MOVE_DEGREES} makes
|
|
72
|
+
* before it animates in, or `null` for a shorter move.
|
|
73
|
+
*/
|
|
74
|
+
function longMoveJump(map: CameraMap, target: MapCameraTarget): JumpToOptions | null {
|
|
75
|
+
const from = map.getCenter()
|
|
76
|
+
const [lon, lat] = cameraTargetCenter(target)
|
|
77
|
+
|
|
78
|
+
const arcDegrees = centralAngle(from.lat, from.lng, lat, lon) * ConversionFactor.RadiansToDegrees
|
|
79
|
+
|
|
80
|
+
if (arcDegrees <= LONG_MOVE_DEGREES) return null
|
|
81
|
+
|
|
82
|
+
return { center: [lon, lat], zoom: Math.min(map.getZoom(), LONG_MOVE_OVERVIEW_ZOOM) }
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Moves `map` to `target`, and returns a function that cancels a move still waiting on its fade.
|
|
87
|
+
*
|
|
88
|
+
* A move animates unless `animate` is false or the reader prefers reduced motion.
|
|
89
|
+
* An animated move longer than {@linkcode LONG_MOVE_DEGREES} first jumps to the target at
|
|
90
|
+
* {@linkcode LONG_MOVE_OVERVIEW_ZOOM}, or at the current zoom when that's lower, then animates in.
|
|
91
|
+
*
|
|
92
|
+
* With a `curtain`, the jump happens under it.
|
|
93
|
+
* The curtain fades in over {@linkcode JUMP_FADE_MS}, then the camera jumps.
|
|
94
|
+
*
|
|
95
|
+
* The curtain fades out over the same time while the camera animates in, and is then removed.
|
|
96
|
+
* The returned function removes the curtain, and a move cancelled before its
|
|
97
|
+
* jump leaves the camera where it was.
|
|
98
|
+
*/
|
|
99
|
+
export function applyCameraTarget(
|
|
100
|
+
map: CameraMap,
|
|
101
|
+
target: MapCameraTarget,
|
|
102
|
+
animate = true,
|
|
103
|
+
curtain: JumpCurtain | null = null
|
|
104
|
+
): () => void {
|
|
105
|
+
const animated = animate && !prefersReducedMotion()
|
|
106
|
+
const jump = animated ? longMoveJump(map, target) : null
|
|
107
|
+
|
|
108
|
+
if (!jump || !curtain) {
|
|
109
|
+
if (jump) {
|
|
110
|
+
map.jumpTo(jump)
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
moveToTarget(map, target, animated)
|
|
114
|
+
|
|
115
|
+
return () => {}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
curtain.cover()
|
|
119
|
+
|
|
120
|
+
let timer = setTimeout(() => {
|
|
121
|
+
map.jumpTo(jump)
|
|
122
|
+
curtain.reveal()
|
|
123
|
+
moveToTarget(map, target, true)
|
|
124
|
+
timer = setTimeout(() => curtain.remove(), JUMP_FADE_MS)
|
|
125
|
+
}, JUMP_FADE_MS)
|
|
126
|
+
|
|
127
|
+
return () => {
|
|
128
|
+
clearTimeout(timer)
|
|
129
|
+
curtain.remove()
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Moves `map` the rest of the way to `target`, animated or not.
|
|
135
|
+
*/
|
|
136
|
+
function moveToTarget(map: CameraMap, target: MapCameraTarget, animated: boolean): void {
|
|
137
|
+
if (target.kind === "center") {
|
|
138
|
+
if (animated) {
|
|
139
|
+
map.flyTo({ center: target.center, zoom: target.zoom })
|
|
140
|
+
} else {
|
|
141
|
+
map.jumpTo({ center: target.center, zoom: target.zoom })
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
return
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
map.fitBounds(target.bounds, fitBoundsOptionsFor(target.padding, animated, target.maxZoom))
|
|
20
148
|
}
|
|
21
149
|
|
|
22
150
|
/**
|
|
@@ -46,17 +174,8 @@ export function ResultCamera({ target, animate = true }: ResultCameraProps): Rea
|
|
|
46
174
|
|
|
47
175
|
if (!instance || !target) return
|
|
48
176
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
instance.flyTo({ center: target.center, zoom: target.zoom })
|
|
52
|
-
} else {
|
|
53
|
-
instance.jumpTo({ center: target.center, zoom: target.zoom })
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
instance.fitBounds(target.bounds, fitBoundsOptionsFor(target.padding, animate))
|
|
177
|
+
// A new target, or an unmount, cancels a fade still in progress.
|
|
178
|
+
return applyCameraTarget(instance, target, animate, createJumpCurtain(instance))
|
|
60
179
|
}, [map, target, animate])
|
|
61
180
|
|
|
62
181
|
return null
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import { Tokens } from "@sister.software/theme"
|
|
8
5
|
import type { ReactNode } from "react"
|
package/lib/map/ResultPanel.tsx
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*/
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
6
3
|
|
|
7
4
|
import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
8
5
|
import type { ReactNode } from "react"
|
|
@@ -13,6 +10,7 @@ import { CopyButton } from "../common/CopyButton.tsx"
|
|
|
13
10
|
import { KindBadge } from "../common/KindBadge.tsx"
|
|
14
11
|
import { CandidatePicker } from "../pipeline/CandidatePicker.tsx"
|
|
15
12
|
import { ComponentTable } from "../pipeline/ComponentTable.tsx"
|
|
13
|
+
import { MatchTable } from "../pipeline/MatchTable.tsx"
|
|
16
14
|
import { ResolvedPlace } from "../pipeline/ResolvedPlace.tsx"
|
|
17
15
|
|
|
18
16
|
export interface ResultPanelProps {
|
|
@@ -61,6 +59,13 @@ export function ResultPanel({
|
|
|
61
59
|
|
|
62
60
|
<ComponentTable nodes={result.nodes} />
|
|
63
61
|
|
|
62
|
+
{result.matches?.length ? (
|
|
63
|
+
<>
|
|
64
|
+
<h2>Matched in the data</h2>
|
|
65
|
+
<MatchTable matches={result.matches} />
|
|
66
|
+
</>
|
|
67
|
+
) : null}
|
|
68
|
+
|
|
64
69
|
{selectedCandidate ? (
|
|
65
70
|
<>
|
|
66
71
|
<ResolvedPlace place={selectedCandidate} />
|