@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,277 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every click on the map as what it landed on: a place label, a rendered feature with
|
|
6
|
+
* a name such as a lake or a park, or bare ground, each with a coordinate.
|
|
7
|
+
*
|
|
8
|
+
* A label is hit within a padded box around the pointer, because a label's glyphs are a small target.
|
|
9
|
+
* The hook resolves the layer list once per style and throttles the hover
|
|
10
|
+
* query to one per animation frame.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { pointInMultiPolygon, pointInPolygon, type PolygonRings } from "@mailwoman/spatial/geometries/polygon"
|
|
14
|
+
import { useEffect, useEffectEvent } from "react"
|
|
15
|
+
import type { MapGeoJSONFeature, MapInstance, MapLayerMouseEvent } from "react-map-gl/maplibre"
|
|
16
|
+
|
|
17
|
+
import type { LngLat } from "#map/place-render"
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The protomaps label layers (`<theme>_label`, `places_*`); other layers are geometry
|
|
21
|
+
* rather than readable place names.
|
|
22
|
+
*/
|
|
23
|
+
const LABEL_LAYER = /_label|^places_/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Properties that may contain a label's text, in trust order.
|
|
27
|
+
*
|
|
28
|
+
* `name` comes from Protomaps.
|
|
29
|
+
* Localized variants appear in script-specific styles.
|
|
30
|
+
*/
|
|
31
|
+
const NAME_KEYS = ["name", "name:en", "name_en"] as const
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Properties that say what kind of feature this is, in trust order: Protomaps writes `kind_detail`
|
|
35
|
+
* for the finer kind (`lake` under `water`) and `kind`, and older tiles `pmap:kind`.
|
|
36
|
+
*/
|
|
37
|
+
const KIND_KEYS = ["kind_detail", "kind", "pmap:kind"] as const
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The land polygon's kind: it is under every click on land, so it identifies no place.
|
|
41
|
+
*/
|
|
42
|
+
const EARTH_KIND = "earth"
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* How far from the pointer, in CSS pixels, a label still counts as clicked.
|
|
46
|
+
*/
|
|
47
|
+
const LABEL_PADDING_PX = 8
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* What a click landed on.
|
|
51
|
+
*/
|
|
52
|
+
export interface MapPick {
|
|
53
|
+
/**
|
|
54
|
+
* `label` for a place label, `feature` for another rendered feature with a name, `ground` for the rest.
|
|
55
|
+
*/
|
|
56
|
+
kind: "label" | "feature" | "ground"
|
|
57
|
+
/**
|
|
58
|
+
* The feature's name, or `null` for bare ground.
|
|
59
|
+
*/
|
|
60
|
+
name: string | null
|
|
61
|
+
/**
|
|
62
|
+
* The feature's kind as the tiles record it, such as `locality` or `lake`, or `null`.
|
|
63
|
+
*/
|
|
64
|
+
placetype: string | null
|
|
65
|
+
/**
|
|
66
|
+
* The feature's own point for a point feature, else the clicked coordinate, as `[lon, lat]`.
|
|
67
|
+
*/
|
|
68
|
+
lngLat: LngLat
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The style's label layer ids.
|
|
73
|
+
*
|
|
74
|
+
* An empty result must stay unqueried, since an empty `layers` option isn't the
|
|
75
|
+
* same as an absent one in `queryRenderedFeatures`.
|
|
76
|
+
*/
|
|
77
|
+
function labelLayerIDs(map: MapInstance): string[] {
|
|
78
|
+
const layers = map.getStyle()?.layers ?? []
|
|
79
|
+
|
|
80
|
+
return layers.map((layer) => layer.id).filter((id) => LABEL_LAYER.test(id))
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function nameOf(feature: MapGeoJSONFeature): string | null {
|
|
84
|
+
for (const key of NAME_KEYS) {
|
|
85
|
+
const value = feature.properties?.[key]
|
|
86
|
+
|
|
87
|
+
if (typeof value === "string" && value.trim()) return value
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return null
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function kindOf(feature: MapGeoJSONFeature): string | null {
|
|
94
|
+
for (const key of KIND_KEYS) {
|
|
95
|
+
const value = feature.properties?.[key]
|
|
96
|
+
|
|
97
|
+
if (typeof value === "string" && value) return value
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return null
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The feature's own point when it is one, else the clicked coordinate.
|
|
105
|
+
*/
|
|
106
|
+
function pointOf(feature: MapGeoJSONFeature, fallback: LngLat): LngLat {
|
|
107
|
+
if (feature.geometry.type === "Point") {
|
|
108
|
+
const [lon, lat] = feature.geometry.coordinates
|
|
109
|
+
|
|
110
|
+
if (typeof lon === "number" && typeof lat === "number") return [lon, lat]
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return fallback
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The topmost label with a name within the padded box around `point`, or `null`.
|
|
118
|
+
*
|
|
119
|
+
* `queryRenderedFeatures` answers topmost-first, so the first feature with a
|
|
120
|
+
* name is the one the click landed on.
|
|
121
|
+
*/
|
|
122
|
+
function labelAt(map: MapInstance, point: MapLayerMouseEvent["point"], layers: string[]): MapGeoJSONFeature | null {
|
|
123
|
+
if (!layers.length) return null
|
|
124
|
+
|
|
125
|
+
const box: [[number, number], [number, number]] = [
|
|
126
|
+
[point.x - LABEL_PADDING_PX, point.y - LABEL_PADDING_PX],
|
|
127
|
+
[point.x + LABEL_PADDING_PX, point.y + LABEL_PADDING_PX],
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
return map.queryRenderedFeatures(box, { layers }).find((feature) => nameOf(feature) !== null) ?? null
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Whether `lngLat` falls inside a rendered polygon feature.
|
|
135
|
+
*
|
|
136
|
+
* A rendered polygon is the piece inside its tile, so a point in another tile reads as outside.
|
|
137
|
+
*/
|
|
138
|
+
function polygonContains(feature: MapGeoJSONFeature, [lon, lat]: LngLat): boolean {
|
|
139
|
+
const { geometry } = feature
|
|
140
|
+
|
|
141
|
+
if (geometry.type === "Polygon") return pointInPolygon(lon, lat, geometry.coordinates as PolygonRings)
|
|
142
|
+
|
|
143
|
+
if (geometry.type === "MultiPolygon") {
|
|
144
|
+
return pointInMultiPolygon(lon, lat, geometry.coordinates as PolygonRings[])
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return false
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The name of an unnamed polygon, read from a rendered label point of the polygon's own label layers
|
|
152
|
+
* that falls inside it: the tiles name a lake on its label point and not on its water polygon.
|
|
153
|
+
*
|
|
154
|
+
* The label layers of a feature layer share its id as a prefix, `water_label_lakes` for `water`.
|
|
155
|
+
* A label in another tile than the clicked piece isn't found, and the polygon then stays unnamed.
|
|
156
|
+
*/
|
|
157
|
+
function nameFromLabelInside(map: MapInstance, polygon: MapGeoJSONFeature, layers: string[]): string | null {
|
|
158
|
+
const ownLabels = layers.filter((id) => id.startsWith(`${polygon.layer.id}_label`))
|
|
159
|
+
|
|
160
|
+
if (!ownLabels.length) return null
|
|
161
|
+
|
|
162
|
+
for (const label of map.queryRenderedFeatures(undefined, { layers: ownLabels })) {
|
|
163
|
+
if (label.geometry.type !== "Point") continue
|
|
164
|
+
|
|
165
|
+
const name = nameOf(label)
|
|
166
|
+
const [lon, lat] = label.geometry.coordinates
|
|
167
|
+
|
|
168
|
+
if (name && typeof lon === "number" && typeof lat === "number" && polygonContains(polygon, [lon, lat])) {
|
|
169
|
+
return name
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return null
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The topmost feature under `point` on any layer but the land polygon, with its name, or `null`.
|
|
178
|
+
*
|
|
179
|
+
* A feature with a name answers first.
|
|
180
|
+
* An unnamed polygon answers with the name of its own label when that label is inside
|
|
181
|
+
* the rendered piece, and else with its kind and no name.
|
|
182
|
+
*/
|
|
183
|
+
function featureAt(
|
|
184
|
+
map: MapInstance,
|
|
185
|
+
point: MapLayerMouseEvent["point"],
|
|
186
|
+
layers: string[]
|
|
187
|
+
): { feature: MapGeoJSONFeature; name: string | null } | null {
|
|
188
|
+
const features = map.queryRenderedFeatures(point).filter((feature) => kindOf(feature) !== EARTH_KIND)
|
|
189
|
+
const named = features.find((feature) => nameOf(feature) !== null)
|
|
190
|
+
|
|
191
|
+
if (named) return { feature: named, name: nameOf(named) }
|
|
192
|
+
|
|
193
|
+
const polygon = features.find((feature) => feature.geometry.type.endsWith("Polygon"))
|
|
194
|
+
|
|
195
|
+
if (!polygon) return null
|
|
196
|
+
|
|
197
|
+
return { feature: polygon, name: nameFromLabelInside(map, polygon, layers) }
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* What a click at `event` landed on.
|
|
202
|
+
*/
|
|
203
|
+
function pickAt(map: MapInstance, event: MapLayerMouseEvent, layers: string[]): MapPick {
|
|
204
|
+
const clicked: LngLat = [event.lngLat.lng, event.lngLat.lat]
|
|
205
|
+
const label = labelAt(map, event.point, layers)
|
|
206
|
+
|
|
207
|
+
if (label) {
|
|
208
|
+
return { kind: "label", name: nameOf(label), placetype: kindOf(label), lngLat: pointOf(label, clicked) }
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const found = featureAt(map, event.point, layers)
|
|
212
|
+
|
|
213
|
+
if (found) {
|
|
214
|
+
return { kind: "feature", name: found.name, placetype: kindOf(found.feature), lngLat: clicked }
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return { kind: "ground", name: null, placetype: null, lngLat: clicked }
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Routes every map click to `onPick` with what it landed on, and shows a pointer over a label.
|
|
222
|
+
*/
|
|
223
|
+
export function useMapPick(map: MapInstance | null, onPick: (pick: MapPick) => void): void {
|
|
224
|
+
// The subscription depends only on the map.
|
|
225
|
+
// `onPick` changes on every render.
|
|
226
|
+
// `useEffectEvent` reads the latest callback without adding it as a reactive dependency.
|
|
227
|
+
const pick = useEffectEvent((picked: MapPick) => onPick(picked))
|
|
228
|
+
|
|
229
|
+
useEffect(() => {
|
|
230
|
+
if (!map) return
|
|
231
|
+
|
|
232
|
+
// Recomputed when the style swaps.
|
|
233
|
+
// Pointer moves read the cached list.
|
|
234
|
+
let layers = labelLayerIDs(map)
|
|
235
|
+
|
|
236
|
+
const readLayers = () => {
|
|
237
|
+
layers = labelLayerIDs(map)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const onClick = (event: MapLayerMouseEvent) => {
|
|
241
|
+
pick(pickAt(map, event, layers))
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
let frame = 0
|
|
245
|
+
|
|
246
|
+
const onMove = (event: MapLayerMouseEvent) => {
|
|
247
|
+
if (frame) return
|
|
248
|
+
|
|
249
|
+
frame = requestAnimationFrame(() => {
|
|
250
|
+
frame = 0
|
|
251
|
+
|
|
252
|
+
const canvas = map.getCanvas()
|
|
253
|
+
|
|
254
|
+
// The drag cursor belongs to the pan gesture.
|
|
255
|
+
// An override mid-drag would fight the map for the pointer.
|
|
256
|
+
if (canvas.style.cursor === "grabbing") return
|
|
257
|
+
|
|
258
|
+
canvas.style.cursor = labelAt(map, event.point, layers) ? "pointer" : ""
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
map.on("styledata", readLayers)
|
|
263
|
+
map.on("click", onClick)
|
|
264
|
+
map.on("mousemove", onMove)
|
|
265
|
+
|
|
266
|
+
return () => {
|
|
267
|
+
if (frame) {
|
|
268
|
+
cancelAnimationFrame(frame)
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
map.off("styledata", readLayers)
|
|
272
|
+
map.off("click", onClick)
|
|
273
|
+
map.off("mousemove", onMove)
|
|
274
|
+
map.getCanvas().style.cursor = ""
|
|
275
|
+
}
|
|
276
|
+
}, [map])
|
|
277
|
+
}
|
|
@@ -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 thin React memo wrapper over the pure {@link computeMapPlaceRenderSpec}; a `null` place yields `null`.
|
|
5
|
+
* The thin React memo wrapper over the pure {@link computeMapPlaceRenderSpec};
|
|
6
|
+
* a `null` place yields `null`.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { useMemo } from "react"
|
|
@@ -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 KeyboardEvent, useCallback, useEffect, useState } from "react"
|
|
8
5
|
|
package/lib/map.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
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `@mailwoman/react/map` — the geocoder map surface, kept behind its own subpath
|
|
6
|
+
* so `maplibre-gl` / `react-map-gl` (WebGL + DOM at import) never enter the package-root graph.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* pulls the map deps. importing `@mailwoman/react` (root) does not. Consumers who only want the
|
|
9
|
-
* parse/POI explorers never pay for maplibre.
|
|
8
|
+
* This subpath import pulls the map deps. importing `@mailwoman/react` (root) doesn't.
|
|
9
|
+
* Consumers who only want the parse/POI explorers never pay for maplibre.
|
|
10
10
|
*
|
|
11
11
|
* The host must supply `maplibre-gl` + `react-map-gl` (peer deps) and import
|
|
12
12
|
* `maplibre-gl/dist/maplibre-gl.css` + `@mailwoman/react/styles.css` itself.
|
|
@@ -22,7 +22,20 @@ export { MapCompass } from "./map/MapCompass.tsx"
|
|
|
22
22
|
export type { MapCompassProps } from "./map/MapCompass.tsx"
|
|
23
23
|
export { useMapBearing } from "./map/useMapBearing.ts"
|
|
24
24
|
export type { UseMapBearing } from "./map/useMapBearing.ts"
|
|
25
|
-
export {
|
|
25
|
+
export { useMapPick } from "./map/useMapPick.ts"
|
|
26
|
+
export type { MapPick } from "./map/useMapPick.ts"
|
|
27
|
+
export { MapPlaceCard, pickQuery } from "./map/MapPlaceCard.tsx"
|
|
28
|
+
export type { MapPlaceCardProps } from "./map/MapPlaceCard.tsx"
|
|
29
|
+
export { MapContextMenu, MapContextMenuAction, MapContextMenuRow, useMapContextMenu } from "./map/MapContextMenu.tsx"
|
|
30
|
+
|
|
31
|
+
export type {
|
|
32
|
+
MapContextMenuActionProps,
|
|
33
|
+
MapContextMenuPoint,
|
|
34
|
+
MapContextMenuProps,
|
|
35
|
+
MapContextMenuRowProps,
|
|
36
|
+
UseMapContextMenu,
|
|
37
|
+
} from "./map/MapContextMenu.tsx"
|
|
38
|
+
|
|
26
39
|
export { MapControlButton, MapControlGroup, MapControlStack } from "./map/MapControlStack.tsx"
|
|
27
40
|
export type { MapControlButtonProps, MapControlGroupProps, MapControlStackProps } from "./map/MapControlStack.tsx"
|
|
28
41
|
export { MapFooter } from "./map/MapFooter.tsx"
|
|
@@ -1,10 +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
|
-
* `<ReachabilityProvider>` keeps a {@linkcode ConnectivityReading} for one service: the browser's `navigator.onLine`
|
|
7
|
-
* and the latest probe of a route on that service.
|
|
5
|
+
* `<ReachabilityProvider>` keeps a {@linkcode ConnectivityReading} for one service:
|
|
6
|
+
* the browser's `navigator.onLine` and the latest probe of a route on that service.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import {
|
|
@@ -31,7 +30,7 @@ import {
|
|
|
31
30
|
export const REACHABLE_PROBE_INTERVAL_MS = 60_000
|
|
32
31
|
|
|
33
32
|
/**
|
|
34
|
-
* The milliseconds between probes while the service
|
|
33
|
+
* The milliseconds between probes while the service doesn't answer,
|
|
35
34
|
* so a recovered service is noticed sooner.
|
|
36
35
|
*/
|
|
37
36
|
export const UNREACHABLE_PROBE_INTERVAL_MS = 10_000
|
|
@@ -1,20 +1,27 @@
|
|
|
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
|
* `CandidatePicker` — the ranked list of alternate gazetteer candidates. clicking one selects it.
|
|
6
|
+
*
|
|
7
7
|
* Presentational. the selected index is owned by the caller (the pipeline hook).
|
|
8
8
|
*
|
|
9
|
-
* The row shows the rank rather than the score.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
9
|
+
* The row shows the rank rather than the score.
|
|
10
|
+
* `ResolvedPlaceView.score` is implementation-defined.
|
|
11
|
+
*
|
|
12
|
+
* Its type specifies "callers should treat as ordinal" — and the backends do
|
|
13
|
+
* not agree on a scale: the FTS regime is a negated bm25 plus additive tiers,
|
|
14
|
+
* while the candidate regime is exactly `log10(population + 1)`.
|
|
15
|
+
* Both regimes put "New York · 6.95" (log10 of 8.9M) directly under "350 5th
|
|
16
|
+
* Ave · 1.00" from a bounded blend.
|
|
17
|
+
*
|
|
18
|
+
* That reads as one number beating another by a factor of seven rather than
|
|
19
|
+
* as two numbers that never shared a scale.
|
|
14
20
|
* `docs/records/reviews/2026-08-04-resolver-score-abstention.md` measures this in full.
|
|
15
21
|
*
|
|
16
|
-
* The raw value stays on the button's `title`, at full precision,
|
|
17
|
-
*
|
|
22
|
+
* The raw value stays on the button's `title`, at full precision,
|
|
23
|
+
* because it is exactly the right thing to have when you're debugging a ranking
|
|
24
|
+
* and exactly the wrong thing to put in a visitor's eyeline.
|
|
18
25
|
*/
|
|
19
26
|
|
|
20
27
|
import type { ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -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
|
-
* `ComponentTable` — the tag / value / confidence table of decoded components. Presentational.
|
|
5
|
+
* `ComponentTable` — the tag / value / confidence table of decoded components.
|
|
6
|
+
* Presentational.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ParsedComponent } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -1,10 +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
|
+
* `ConfidenceCell` — a compact confidence bar + value for the component table.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* The fill color follows the shared confidence tiers.
|
|
8
|
+
* Presentational.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import { confidenceTierOrMid } from "#common/confidence-tiers"
|
|
@@ -1,10 +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
|
-
* Explains a query that resolved to no place and suggests which component, such as a city or a
|
|
7
|
-
* state, the visitor could add.
|
|
5
|
+
* Explains a query that resolved to no place and suggests which component,
|
|
6
|
+
* such as a city or a state, the visitor could add.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
9
|
import type { ParsedComponent } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// SPDX-FileCopyrightText: Teffen Ellis and Mailwoman contributors
|
|
2
|
+
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* `MatchTable` — what the data held for each parsed component.
|
|
6
|
+
* Presentational.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { isPresent } from "@mailwoman/core/objects"
|
|
10
|
+
import type { ComponentMatch } from "@mailwoman/core/pipeline/client-result"
|
|
11
|
+
import type { ReactNode } from "react"
|
|
12
|
+
|
|
13
|
+
export interface MatchTableProps {
|
|
14
|
+
matches: ComponentMatch[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function describeMatch({ matched, name, placetype, placeID, note }: ComponentMatch): string {
|
|
18
|
+
if (!matched) return note ? `no match: ${note}` : "no match"
|
|
19
|
+
|
|
20
|
+
const found = [name, placetype ? `(${placetype})` : null, placeID].filter(isPresent).join(" ")
|
|
21
|
+
|
|
22
|
+
return note ? `${found}: ${note}` : found
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function MatchTable({ matches }: MatchTableProps): ReactNode {
|
|
26
|
+
return (
|
|
27
|
+
<table className="mw-components">
|
|
28
|
+
<thead>
|
|
29
|
+
<tr>
|
|
30
|
+
<th>tag</th>
|
|
31
|
+
<th>value</th>
|
|
32
|
+
<th>matched</th>
|
|
33
|
+
</tr>
|
|
34
|
+
</thead>
|
|
35
|
+
<tbody>
|
|
36
|
+
{matches.map((match, i) => (
|
|
37
|
+
<tr key={i}>
|
|
38
|
+
<td>{match.tag}</td>
|
|
39
|
+
<td>{match.value}</td>
|
|
40
|
+
<td>{describeMatch(match)}</td>
|
|
41
|
+
</tr>
|
|
42
|
+
))}
|
|
43
|
+
</tbody>
|
|
44
|
+
</table>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
@@ -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
|
-
*
|
|
3
|
-
* @license AGPL-3.0
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `PipelineExplorer` — the composed parse+resolve tester.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* Drives the injected {@link PipelineRuntime} through {@link useParsePipeline},
|
|
8
|
+
* renders the core result (kind badge, component table, resolved place, candidate picker),
|
|
9
|
+
* and slots host-supplied panels (span highlight, tree, timing, …) around it.
|
|
10
|
+
* No model/gazetteer code here — composition + a `ClientOnly` SSR boundary only.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
import type { ReactNode } from "react"
|
|
@@ -1,10 +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
|
+
* `QueryForm` — the address input + submit button for the pipeline explorer.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
7
|
+
* Shows a spinner while parsing.
|
|
8
|
+
* Presentational; `onSubmit` fires on form submission.
|
|
8
9
|
*/
|
|
9
10
|
|
|
10
11
|
import type { InputHTMLAttributes, KeyboardEvent, ReactNode } from "react"
|
|
@@ -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
|
-
* `ResolvedPlace` — the "Resolved place" detail list (name, placetype, WOF id, coords, score). Presentational.
|
|
5
|
+
* `ResolvedPlace` — the "Resolved place" detail list (name, placetype, WOF id, coords, score).
|
|
6
|
+
* Presentational.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import type { ResolvedPlaceView } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -23,7 +23,7 @@ export function ResolvedPlace({ place }: ResolvedPlaceProps): ReactNode {
|
|
|
23
23
|
<dt>placetype</dt>
|
|
24
24
|
<dd>{place.placetype}</dd>
|
|
25
25
|
{place.tier ? (
|
|
26
|
-
// A street-tier answer
|
|
26
|
+
// A street-tier answer isn't a gazetteer place: it has a precision instead of an id.
|
|
27
27
|
<>
|
|
28
28
|
<dt>precision</dt>
|
|
29
29
|
<dd>
|
|
@@ -1,11 +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
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `SpanHighlight` — a displaCy-style span ribbon over the raw input: each tagged span is
|
|
6
|
+
* a column with the text on top, tinted by its confidence tier, with the tag beneath.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* plain text, so a dropped span is visible as a literal break in the color.
|
|
8
|
+
* Gaps (delimiters, unparsed characters) fall through as plain text,
|
|
9
|
+
* so a dropped span is visible as a literal break in the color.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import type { ParsedComponent } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -1,11 +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
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @author Teffen Ellis, et al.
|
|
5
|
+
* `TimingPanel` — the per-stage timing breakdown: a stacked bar sized by each
|
|
6
|
+
* stage's wall-clock, plus a legend.
|
|
5
7
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* not quality.
|
|
8
|
+
* Stage colors are distinct hues, never the confidence red/amber/green,
|
|
9
|
+
* because they encode the pipeline stage and not quality.
|
|
9
10
|
*/
|
|
10
11
|
|
|
11
12
|
import type { StageTiming } from "@mailwoman/core/pipeline/client-result"
|
|
@@ -1,10 +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
|
+
* `TreeView` — the parse's containment tree as nested lists with a guide rail per level.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
* confidence tier. the value and score render in monospace.
|
|
7
|
+
* The tag tint follows the confidence tier. the value and score render in monospace.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import type { ReactNode } from "react"
|
package/lib/pipeline/copy.ts
CHANGED
|
@@ -1,10 +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
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Builds the "Copy JSON" payload for a parse result — the components + the selected resolved place,
|
|
7
|
-
* pretty-printed. Pure. shared by the explorer's copy button.
|
|
5
|
+
* Builds the "Copy JSON" payload for a parse result — the components + the
|
|
6
|
+
* selected resolved place, pretty-printed.
|
|
7
|
+
* Pure. shared by the explorer's copy button.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { prettyJSON } from "@mailwoman/core/json"
|