@mailwoman/react 11.0.0 → 11.1.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 +2 -2
- 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 +3 -3
- 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 +77 -49
- 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 +0 -3
- 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 +23 -9
- 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 +6 -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
|
@@ -1,12 +1,13 @@
|
|
|
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
|
* Paints the procedural star sky onto a canvas that sits behind the map.
|
|
7
6
|
*
|
|
8
|
-
* Under globe projection MapLibre leaves its canvas transparent outside the sphere,
|
|
9
|
-
*
|
|
7
|
+
* Under globe projection MapLibre leaves its canvas transparent outside the sphere,
|
|
8
|
+
* so a canvas stacked beneath it shows through around the globe.
|
|
9
|
+
* This component renders as a `<Map>` child so it can read the map instance.
|
|
10
|
+
*
|
|
10
11
|
* It redraws the sky canvas that `<MapCanvas>` owns on every camera move.
|
|
11
12
|
*/
|
|
12
13
|
|
|
@@ -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
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* Renders a selector for the available model versions. The host owns loading and selection.
|
|
5
|
+
* Renders a selector for the available model versions.
|
|
6
|
+
* The host owns loading and selection.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ReactNode } from "react"
|
package/lib/map/fake-runtime.ts
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 } from "@mailwoman/core/pipeline/client-result"
|
|
8
5
|
|
package/lib/map/geometry.ts
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 { LatLonBounds } from "@mailwoman/spatial"
|
|
8
5
|
|
|
@@ -41,7 +38,7 @@ function circleRing(lat: number, lon: number, radiusKM: number): number[][] {
|
|
|
41
38
|
|
|
42
39
|
/**
|
|
43
40
|
* Returns a circle approximating the extent of a place that has no polygon, with a radius
|
|
44
|
-
* of half the bbox diagonal clamped to 0.5–50 km, or 3 km when there
|
|
41
|
+
* of half the bbox diagonal clamped to 0.5–50 km, or 3 km when there's no bbox.
|
|
45
42
|
*/
|
|
46
43
|
export function approxCircleGeometry(lat: number, lon: number, bbox?: LatLonBounds): PlaceGeometry {
|
|
47
44
|
const halfDiagKm = bbox
|
package/lib/map/graticule.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
+
* The graticule's geometry, apart from its component — the same split
|
|
6
|
+
* `place-render.ts` keeps from `ResolvedPlaceLayers.tsx`.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
* `ResolvedPlaceLayers.tsx`. Pure and node-testable; `#*` resolves `.ts` only, so this is also the file the test can
|
|
8
|
-
* import.
|
|
8
|
+
* Pure and node-testable; `#*` resolves `.ts` only, so this is also the file the test can import.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { FeatureCollection, MultiLineString } from "geojson"
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A full-map overlay that hides the instant change of view when a long camera move jumps across the globe.
|
|
6
|
+
*
|
|
7
|
+
* The overlay fades in over the map, the camera jumps under it, and it fades
|
|
8
|
+
* out as the camera animates in.
|
|
9
|
+
* It takes the color of the style's background layer.
|
|
10
|
+
*
|
|
11
|
+
* A dark style therefore fades through its own dark background rather than through white.
|
|
12
|
+
*
|
|
13
|
+
* The overlay never takes pointer events, and it is removed after its fade-out.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The length, in milliseconds, of each half of the fade: in over the old view, then out over the new one.
|
|
18
|
+
*/
|
|
19
|
+
export const JUMP_FADE_MS = 75
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The steps of one jump's fade.
|
|
23
|
+
*/
|
|
24
|
+
export interface JumpCurtain {
|
|
25
|
+
/**
|
|
26
|
+
* Fades the overlay in over {@linkcode JUMP_FADE_MS}.
|
|
27
|
+
*/
|
|
28
|
+
cover(): void
|
|
29
|
+
/**
|
|
30
|
+
* Fades the overlay out over {@linkcode JUMP_FADE_MS}.
|
|
31
|
+
*/
|
|
32
|
+
reveal(): void
|
|
33
|
+
/**
|
|
34
|
+
* Removes the overlay at once, whatever step it's at.
|
|
35
|
+
*/
|
|
36
|
+
remove(): void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The map methods the overlay reads, a subset of MapLibre's `Map`.
|
|
41
|
+
*/
|
|
42
|
+
export interface CurtainMap {
|
|
43
|
+
getContainer(): HTMLElement
|
|
44
|
+
getCanvasContainer(): HTMLElement
|
|
45
|
+
getStyle(): { layers?: ReadonlyArray<{ id: string; type: string }> } | undefined
|
|
46
|
+
getPaintProperty(layerID: string, name: string): unknown
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The color the overlay fades through.
|
|
51
|
+
*
|
|
52
|
+
* It is the style's first background layer's color when that color is a literal.
|
|
53
|
+
* Otherwise it is the map container's computed background.
|
|
54
|
+
* The page's theme sets that background.
|
|
55
|
+
*/
|
|
56
|
+
export function curtainColor(map: CurtainMap): string {
|
|
57
|
+
const background = map.getStyle()?.layers?.find((layer) => layer.type === "background")
|
|
58
|
+
const paint = background ? map.getPaintProperty(background.id, "background-color") : null
|
|
59
|
+
|
|
60
|
+
if (typeof paint === "string" && paint) return paint
|
|
61
|
+
|
|
62
|
+
return getComputedStyle(map.getContainer()).backgroundColor
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Creates the overlay for one jump on `map`.
|
|
67
|
+
*
|
|
68
|
+
* The overlay sits directly above the canvas, so the map's controls stay drawn over it.
|
|
69
|
+
*/
|
|
70
|
+
export function createJumpCurtain(map: CurtainMap): JumpCurtain {
|
|
71
|
+
let overlay: HTMLDivElement | null = null
|
|
72
|
+
|
|
73
|
+
const fade = (from: number, to: number) => {
|
|
74
|
+
overlay?.animate([{ opacity: from }, { opacity: to }], {
|
|
75
|
+
duration: JUMP_FADE_MS,
|
|
76
|
+
easing: "linear",
|
|
77
|
+
fill: "forwards",
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return {
|
|
82
|
+
cover() {
|
|
83
|
+
overlay ??= document.createElement("div")
|
|
84
|
+
overlay.dataset["mwJumpCurtain"] = ""
|
|
85
|
+
|
|
86
|
+
Object.assign(overlay.style, {
|
|
87
|
+
position: "absolute",
|
|
88
|
+
inset: "0",
|
|
89
|
+
pointerEvents: "none",
|
|
90
|
+
opacity: "0",
|
|
91
|
+
background: curtainColor(map),
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
map.getCanvasContainer().after(overlay)
|
|
95
|
+
fade(0, 1)
|
|
96
|
+
},
|
|
97
|
+
reveal() {
|
|
98
|
+
fade(1, 0)
|
|
99
|
+
},
|
|
100
|
+
remove() {
|
|
101
|
+
overlay?.remove()
|
|
102
|
+
overlay = null
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
}
|
package/lib/map/map-debug.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
5
|
* @file The bare MapLibre control both debug panels portal into.
|
|
6
6
|
*
|
|
7
7
|
* `DashboardMap`'s inspector and the demo page's `_debug.tsx` panel each need an `IControl` whose
|
|
8
8
|
* only job is to own a container element for `createPortal`. The class was duplicated in both.
|
|
9
|
-
* the position and container class are the only differences, so they
|
|
9
|
+
* the position and container class are the only differences, so they're parameters here.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import type { ControlPosition } from "maplibre-gl"
|
package/lib/map/place-render.ts
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 { ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
8
5
|
import type { LatLonBounds } from "@mailwoman/spatial"
|
|
@@ -54,7 +51,15 @@ export interface ResolvedMapPlace extends ResolvedPlaceView {
|
|
|
54
51
|
*/
|
|
55
52
|
export type MapCameraTarget =
|
|
56
53
|
| { kind: "center"; center: LngLat; zoom: number }
|
|
57
|
-
| {
|
|
54
|
+
| {
|
|
55
|
+
kind: "bounds"
|
|
56
|
+
bounds: BoundsTuple
|
|
57
|
+
padding: number
|
|
58
|
+
/**
|
|
59
|
+
* The closest the fit may zoom, for bounds a few meters across.
|
|
60
|
+
*/
|
|
61
|
+
maxZoom?: number
|
|
62
|
+
}
|
|
58
63
|
|
|
59
64
|
/**
|
|
60
65
|
* The markers, outline and camera target for one resolved place, as returned
|
|
@@ -62,7 +67,7 @@ export type MapCameraTarget =
|
|
|
62
67
|
*/
|
|
63
68
|
export interface MapPlaceRenderSpec {
|
|
64
69
|
/**
|
|
65
|
-
* The marker positions as `[lon, lat]`; there
|
|
70
|
+
* The marker positions as `[lon, lat]`; there's always exactly one marker.
|
|
66
71
|
*/
|
|
67
72
|
markers: LngLat[]
|
|
68
73
|
|
|
@@ -92,15 +97,28 @@ const MIN_EXTENT_DEG = 0.001
|
|
|
92
97
|
export function computeMapPlaceRenderSpec(place: ResolvedMapPlace): MapPlaceRenderSpec {
|
|
93
98
|
const markers: LngLat[] = [[place.lon, place.lat]]
|
|
94
99
|
|
|
95
|
-
|
|
100
|
+
// An uncertainty radius draws as a circle whether or not a street tier set it:
|
|
101
|
+
// a decoded plus code or H3 cell has one too.
|
|
102
|
+
// The two street tiers keep their fixed zooms.
|
|
103
|
+
// Any other radius fits its circle and stops at the address-point zoom.
|
|
104
|
+
if (place.uncertaintyM != null) {
|
|
105
|
+
const outline = radiusCircleGeometry(place.lat, place.lon, place.uncertaintyM)
|
|
106
|
+
|
|
96
107
|
return {
|
|
97
108
|
markers,
|
|
98
|
-
outline
|
|
99
|
-
camera:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
109
|
+
outline,
|
|
110
|
+
camera: place.tier
|
|
111
|
+
? {
|
|
112
|
+
kind: "center",
|
|
113
|
+
center: [place.lon, place.lat],
|
|
114
|
+
zoom: place.tier === "address_point" ? ZOOM.addressPoint : ZOOM.interpolated,
|
|
115
|
+
}
|
|
116
|
+
: {
|
|
117
|
+
kind: "bounds",
|
|
118
|
+
bounds: bboxToBounds(geomBounds(outline)),
|
|
119
|
+
padding: FIT_PADDING,
|
|
120
|
+
maxZoom: ZOOM.addressPoint,
|
|
121
|
+
},
|
|
104
122
|
}
|
|
105
123
|
}
|
|
106
124
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the viewer asked for reduced motion.
|
|
6
|
+
* A camera move then jumps instead of flying.
|
|
7
|
+
*
|
|
8
|
+
* Answers false where `matchMedia` doesn't exist, so a test environment without
|
|
9
|
+
* a window gets the animated default.
|
|
10
|
+
*/
|
|
11
|
+
export function prefersReducedMotion(): boolean {
|
|
12
|
+
return typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches
|
|
13
|
+
}
|
package/lib/map/starfield.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
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
|
* A procedural star sky for the globe projection, and the camera math that places it on screen.
|
|
7
6
|
*
|
|
8
|
-
* Stars are unit vectors fixed to the Earth's frame, so the sky turns with
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
7
|
+
* Stars are unit vectors fixed to the Earth's frame, so the sky turns with
|
|
8
|
+
* the globe as the camera orbits it.
|
|
9
|
+
* Their magnitudes follow the naked-eye count law, where each fainter magnitude holds about
|
|
10
|
+
* 3.2 times the star count, and a share of them crowd a band along the real galactic plane.
|
|
11
|
+
*
|
|
12
|
+
* The catalog is seeded, so every render of the same options draws the same sky.
|
|
12
13
|
*
|
|
13
14
|
* This module touches no DOM or WebGL at import, so node tests can load it.
|
|
14
15
|
*/
|
package/lib/map/types.ts
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
|
+
* Types for the geocoder map surface.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* Its `react-map-gl/maplibre` imports are type-only, so the module stays node-safe.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import type { ParseResult, ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -14,6 +15,7 @@ import type { LngLat, ResolvedMapPlace } from "#map/place-render"
|
|
|
14
15
|
import type { PipelineRuntime } from "#pipeline/types"
|
|
15
16
|
|
|
16
17
|
import type { MapCanvasStyle } from "./MapCanvas.tsx"
|
|
18
|
+
import type { MapContextMenuPoint } from "./MapContextMenu.tsx"
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* An alias for {@link LngLat}.
|
|
@@ -257,4 +259,11 @@ export interface GeocoderPanels {
|
|
|
257
259
|
* A permalink control for the current address (host's PermalinkButton).
|
|
258
260
|
*/
|
|
259
261
|
permalink?: (text: string) => ReactNode
|
|
262
|
+
/**
|
|
263
|
+
* The rows of the map's right-click menu for a point, such as the point's coordinates
|
|
264
|
+
* in each encoding the host offers, as `MapContextMenuRow` elements.
|
|
265
|
+
*
|
|
266
|
+
* The menu itself, its placement and its search action belong to the package.
|
|
267
|
+
*/
|
|
268
|
+
contextMenu?: (point: MapContextMenuPoint) => ReactNode
|
|
260
269
|
}
|
|
@@ -1,13 +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
|
-
* @copyright Sister Software
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
5
|
* `useCompareState` — the small headless state machine behind the demo's compare toggle
|
|
7
6
|
* (`_app.tsx:142-143, 1238-1305`): whether compare mode is on and which version to compare against.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* The off state clears the chosen version.
|
|
9
|
+
* A selected compare version equal to the primary is rejected
|
|
10
|
+
* (the picker filters it out, this guards the programmatic path).
|
|
11
|
+
*
|
|
12
|
+
* The second parse itself is a host concern surfaced through `panels.compare` —
|
|
13
|
+
* this hook owns only the toggle + selection.
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
import { useCallback, useState } from "react"
|
package/lib/map/useGeocode.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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
|
+
* `useGeocode` — the parse+resolve state machine for the geocoder map.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* concerns the geocoder adds over the base explorer:
|
|
7
|
+
* It reuses the pipeline's `useParsePipeline` (text / busy / stage / result / candidate selection)
|
|
8
|
+
* and layers on the two map-only concerns the geocoder adds over the base explorer:
|
|
9
9
|
*
|
|
10
10
|
* 1. Viewport bias — when the runtime exposes `runParseWithBias`, the current map center (read through
|
|
11
11
|
* an injected `getBias`, itself reading the `MapRef`) supplies a soft proximity prior. The
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
* richer {@link ResolvedMapPlace} the declarative overlays consume (bbox / tier / polygon). Absent
|
|
15
15
|
* an enricher, the candidate renders as a bare point.
|
|
16
16
|
*
|
|
17
|
-
* No maplibre import at module scope — the map handle is reached only through the
|
|
18
|
-
* callback, so this hook stays independent of the map binding.
|
|
17
|
+
* No maplibre import at module scope — the map handle is reached only through the
|
|
18
|
+
* injected `getBias` callback, so this hook stays independent of the map binding.
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import { useMemo } from "react"
|
|
21
|
+
import { useCallback, useMemo, useState } from "react"
|
|
22
22
|
|
|
23
23
|
import type { ResolvedMapPlace } from "#map/place-render"
|
|
24
24
|
import type { GeocoderRuntime, MapBias } from "#map/types"
|
|
@@ -44,9 +44,21 @@ export interface UseGeocodeOptions {
|
|
|
44
44
|
|
|
45
45
|
export interface UseGeocode extends UseParsePipeline {
|
|
46
46
|
/**
|
|
47
|
-
* The
|
|
47
|
+
* The pinned place when one is set, else the selected candidate enriched into the
|
|
48
|
+
* map-render shape (bbox / tier / polygon), or `null`.
|
|
48
49
|
*/
|
|
49
50
|
mapPlace: ResolvedMapPlace | null
|
|
51
|
+
/**
|
|
52
|
+
* A place the map shows without a parse, such as a clicked label at the tile
|
|
53
|
+
* feature's own coordinate, or `null`.
|
|
54
|
+
*
|
|
55
|
+
* The next submit or reset clears it.
|
|
56
|
+
*/
|
|
57
|
+
pinned: ResolvedMapPlace | null
|
|
58
|
+
/**
|
|
59
|
+
* Show `place` on the map in place of the result's candidate, or clear the pin with `null`.
|
|
60
|
+
*/
|
|
61
|
+
pin: (place: ResolvedMapPlace | null) => void
|
|
50
62
|
}
|
|
51
63
|
|
|
52
64
|
export function useGeocode({ runtime, defaultText, getBias }: UseGeocodeOptions): UseGeocode {
|
|
@@ -64,8 +76,9 @@ export function useGeocode({ runtime, defaultText, getBias }: UseGeocodeOptions)
|
|
|
64
76
|
}, [runtime, getBias])
|
|
65
77
|
|
|
66
78
|
const pipeline = useParsePipeline({ runtime: geoRuntime, defaultText })
|
|
79
|
+
const [pinned, pin] = useState<ResolvedMapPlace | null>(null)
|
|
67
80
|
|
|
68
|
-
const
|
|
81
|
+
const candidatePlace = useMemo<ResolvedMapPlace | null>(() => {
|
|
69
82
|
if (!pipeline.selectedCandidate || !pipeline.result) return null
|
|
70
83
|
|
|
71
84
|
return runtime.resolveMapPlace
|
|
@@ -73,5 +86,22 @@ export function useGeocode({ runtime, defaultText, getBias }: UseGeocodeOptions)
|
|
|
73
86
|
: pipeline.selectedCandidate
|
|
74
87
|
}, [pipeline.selectedCandidate, pipeline.result, runtime])
|
|
75
88
|
|
|
76
|
-
|
|
89
|
+
// A parse answers the question the pin stood in for, so either one clears it.
|
|
90
|
+
const { submit, reset } = pipeline
|
|
91
|
+
|
|
92
|
+
const submitAndUnpin = useCallback(
|
|
93
|
+
(query?: string) => {
|
|
94
|
+
pin(null)
|
|
95
|
+
|
|
96
|
+
return submit(query)
|
|
97
|
+
},
|
|
98
|
+
[submit]
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const resetAndUnpin = useCallback(() => {
|
|
102
|
+
pin(null)
|
|
103
|
+
reset()
|
|
104
|
+
}, [reset])
|
|
105
|
+
|
|
106
|
+
return { ...pipeline, submit: submitAndUnpin, reset: resetAndUnpin, mapPlace: pinned ?? candidatePlace, pinned, pin }
|
|
77
107
|
}
|
package/lib/map/useMapBearing.ts
CHANGED
|
@@ -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
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
-
*
|
|
6
|
-
* The map's rotation as React state, read through `useSyncExternalStore` and subscribed to `move` as well as `rotate`, since a `flyTo` or `easeTo` carrying a direction fires no rotate event.
|
|
5
|
+
* The map's rotation as React state, read through `useSyncExternalStore` and subscribed to `move`
|
|
6
|
+
* as well as `rotate`, since a `flyTo` or `easeTo` carrying a direction fires no rotate event.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { useCallback, useSyncExternalStore } from "react"
|
|
@@ -15,12 +15,12 @@ import type { MapInstance } from "react-map-gl/maplibre"
|
|
|
15
15
|
export interface UseMapBearing {
|
|
16
16
|
/**
|
|
17
17
|
* Degrees off north, as MapLibre reports it.
|
|
18
|
-
* Zero while there
|
|
18
|
+
* Zero while there's no map.
|
|
19
19
|
*/
|
|
20
20
|
bearing: number
|
|
21
21
|
/**
|
|
22
22
|
* Rotate the map back to north.
|
|
23
|
-
* A no-op while there
|
|
23
|
+
* A no-op while there's no map.
|
|
24
24
|
*/
|
|
25
25
|
resetNorth: () => void
|
|
26
26
|
}
|